Boa tarde,
Veja agora, com as alterações:
Salva no Formato *.xls (excel 97/2003 *conf. solicitado)
Sub Mail_Every_Worksheet_With_Address_In_A1_PDF_CRIA_PDF_DA_PAGINA_PREENCHIADA()
Application.ScreenUpdating = False
Dim Sh As Worksheet
Dim TempFilePath As String
Dim TempFileName As String
Dim FileName As String
For Each Sh In ThisWorkbook.Worksheets
Sh.Visible = xlSheetVisible
Next Sh
TempFilePath = Environ$("temp") & ""
TempFilePath = "D:PVPDF"
For Each Sh In ThisWorkbook.Worksheets
FileName = ""
If Sh.Range("V2").Value Like "1" Then
TempFileName = TempFilePath _
& Sheets("SET").Range("K19") _
& " - " _
& Sheets("A").Range("D1").Value _
& "" _
& Format(Sheets("SET").Range("B332").Value, "00000") _
& " - " _
& Format(Now, "dd-mm-yyyy") _
& ".pdf"
FileName = RDB_Create_PDF(Source:=Sh, _
FixedFilePathName:=TempFileName, _
OverwriteIfFileExist:=True, _
OpenPDFAfterPublish:=False)
TempFilePath = "D:XLS"
TempFileName = TempFilePath _
& Sheets("SET").Range("K19") _
& " - " _
& Sheets("A").Range("D1").Value _
& "" _
& Format(Sheets("SET").Range("B332").Value, "00000") _
& " - " _
& Format(Now, "dd-mm-yyyy") _
& ".xls"
Dim wb As Workbook
Set wb = Workbooks.Add
Sh.Copy Before:=wb.Sheets(1)
' salva formato xls
wb.SaveAs TempFileName, FileFormat:=56
wb.Close savechanges:=True
End If
Next Sh
ThisWorkbook.Activate
For Each Sh In ThisWorkbook.Worksheets
If UCase(Sh.Name) <> UCase("A") Then
Sh.Visible = xlSheetVeryHidden
End If
Next Sh
Application.ScreenUpdating = True
End Sub
Click em se a resposta foi util!
Postado : 27/09/2016 9:03 am