Como determinar a impressão de apenas uma planilha neste cod
Enviado: 10 Mar 2016 às 17:43
Boa tarde!
Como determinar a impressão em pdf de apenas uma planilha neste código.
Ela imprime todas, mas me bastaria uma.
Como posso determinar que ela faça somente em uma planilha, ex: "P01"
Obs: não posso apagar a "D1" das outras planilhas.
Sei que o código está bagunçado, mas agradeço que puder me ajudar
Grato!
'CRIAR PDF <<<<<<
'Create a PDF and mail of every sheet with a mail address in cell A1 (Sheet5 and sheet6)
'You see that the code create two mails, one with sheet5 and one with sheet6 and send it
'to the address in A1 of that sheet.
Sub Mail_Every_Worksheet_With_Address_In_A1_PDF2()
'Working only in 2007 and up
Dim sh As Worksheet
Dim TempFilePath As String
Dim TempFileName As String
Dim FileName As String
Dim vCelula As Range
'Temporary path to save the PDF files
'You can also use another folder like
'TempFilePath = "C:\Users\Ron\MyFolder\"
'or TempFilePath = Environ$("temp") & "\"
TempFilePath = "D:\PDF\"
'Loop through every worksheet
For Each Sheets("P01") In ThisWorkbook.Worksheets
FileName = ""
'Test A1 for a mail address
'If sh.Range("M8").Value Like "?*@?*.?*" Then
'Test A1 for a mail address (SUBSTITUIR PELO TOTAL)
If Sheets("A").Range("D1").Value Like "?*" Then
'If there is a mail address in A1 create the file name and the PDF
TempFileName = TempFilePath _
& "CVLO" _
& " " _
& Sheets("A").Range("D1").Value _
& " " _
& Format(Sheets("A").Range("Q2").Value, "00000") _
& Format(Now, " dd-mm-yyyy") _
& ".pdf"
FileName = RDB_Create_PDF(Source:=sh, _
FixedFilePathName:=TempFileName, _
OverwriteIfFileExist:=True, _
OpenPDFAfterPublish:=False)
For Each vCelula In Sheets("X").Range("Q2").Cells
vCelula.Value = vCelula.Value + 1
Next
ActiveWorkbook.Save
End If
' Call LimparCelulas
Next sh
End Sub
Como determinar a impressão em pdf de apenas uma planilha neste código.
Ela imprime todas, mas me bastaria uma.
Como posso determinar que ela faça somente em uma planilha, ex: "P01"
Obs: não posso apagar a "D1" das outras planilhas.
Sei que o código está bagunçado, mas agradeço que puder me ajudar
Grato!
'CRIAR PDF <<<<<<
'Create a PDF and mail of every sheet with a mail address in cell A1 (Sheet5 and sheet6)
'You see that the code create two mails, one with sheet5 and one with sheet6 and send it
'to the address in A1 of that sheet.
Sub Mail_Every_Worksheet_With_Address_In_A1_PDF2()
'Working only in 2007 and up
Dim sh As Worksheet
Dim TempFilePath As String
Dim TempFileName As String
Dim FileName As String
Dim vCelula As Range
'Temporary path to save the PDF files
'You can also use another folder like
'TempFilePath = "C:\Users\Ron\MyFolder\"
'or TempFilePath = Environ$("temp") & "\"
TempFilePath = "D:\PDF\"
'Loop through every worksheet
For Each Sheets("P01") In ThisWorkbook.Worksheets
FileName = ""
'Test A1 for a mail address
'If sh.Range("M8").Value Like "?*@?*.?*" Then
'Test A1 for a mail address (SUBSTITUIR PELO TOTAL)
If Sheets("A").Range("D1").Value Like "?*" Then
'If there is a mail address in A1 create the file name and the PDF
TempFileName = TempFilePath _
& "CVLO" _
& " " _
& Sheets("A").Range("D1").Value _
& " " _
& Format(Sheets("A").Range("Q2").Value, "00000") _
& Format(Now, " dd-mm-yyyy") _
& ".pdf"
FileName = RDB_Create_PDF(Source:=sh, _
FixedFilePathName:=TempFileName, _
OverwriteIfFileExist:=True, _
OpenPDFAfterPublish:=False)
For Each vCelula In Sheets("X").Range("Q2").Cells
vCelula.Value = vCelula.Value + 1
Next
ActiveWorkbook.Save
End If
' Call LimparCelulas
Next sh
End Sub