I want to save certain sheets as a PDF file with a specific path, have a default file name with the option to edit the file name which also opens the PDF file.
Seems to work with desired path and option to change default file name, but the PDF file is never saved and the code continues to the end where the excel file is saved.
Any help to tweak the following would be appreciated.
Sub SavePDF()
'
' SavePDF Macro
'
'
Dim FileAndLocation As Variant
Dim strPathLocation As String
Dim strFilename As String
Dim strPathFile As String
strPathLocation = Worksheets("Master").Range("D3").Value
strFilename = Worksheets("Master").Range("D2").Value
strPathFile = strPathLocation & strFilename
Sheets("DPV Test Log I-1-1 ").Select
ActiveWindow.ScrollWorkbookTabs Sheets:=16
Sheets(Array("DPV Test Log I-1-1 ", "DPV Test Log I-1-1A", "DPV Test Log I-1-2", _
"DPV Test Log I-1-3 #1 ", "DPV Test Log I-1-3 #2 ", "DPV Test Log I-1-3 #3 ", _
"DPV Test Log I-1-12 Lunch room", "DPV Test Log I-1-20", "DPV Test Log I-1-23 #1 " _
, "DPV Test Log I-1-23 #2 ", "DPV Test Log I-1-34", "DPV Test Log I-1-58", _
"DPV Test Log I-1-88", "DPV Test Log I-1-101", "DPV Test Log I-1-134", _
"DPV Test Log F2-10", "DPV Test Log F-6-45", "DPV Test Log P-1-1", _
"DPV Test Log S-3-3", "DPV Test Log T-1-3", "DPV Test Log T-1-9")).Select
Sheets("DPV Test Log I-1-1 ").Activate
FileAndLocation = Application.GetSaveAsFilename _
(InitialFileName:=strPathLocation & strFilename, _
filefilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and FileName to save")
ActiveWindow.ScrollWorkbookTabs Sheets:=-16
Sheets("Master").Select
ActiveWorkbook.Save
End Sub
Seems to work with desired path and option to change default file name, but the PDF file is never saved and the code continues to the end where the excel file is saved.
Any help to tweak the following would be appreciated.
Sub SavePDF()
'
' SavePDF Macro
'
'
Dim FileAndLocation As Variant
Dim strPathLocation As String
Dim strFilename As String
Dim strPathFile As String
strPathLocation = Worksheets("Master").Range("D3").Value
strFilename = Worksheets("Master").Range("D2").Value
strPathFile = strPathLocation & strFilename
Sheets("DPV Test Log I-1-1 ").Select
ActiveWindow.ScrollWorkbookTabs Sheets:=16
Sheets(Array("DPV Test Log I-1-1 ", "DPV Test Log I-1-1A", "DPV Test Log I-1-2", _
"DPV Test Log I-1-3 #1 ", "DPV Test Log I-1-3 #2 ", "DPV Test Log I-1-3 #3 ", _
"DPV Test Log I-1-12 Lunch room", "DPV Test Log I-1-20", "DPV Test Log I-1-23 #1 " _
, "DPV Test Log I-1-23 #2 ", "DPV Test Log I-1-34", "DPV Test Log I-1-58", _
"DPV Test Log I-1-88", "DPV Test Log I-1-101", "DPV Test Log I-1-134", _
"DPV Test Log F2-10", "DPV Test Log F-6-45", "DPV Test Log P-1-1", _
"DPV Test Log S-3-3", "DPV Test Log T-1-3", "DPV Test Log T-1-9")).Select
Sheets("DPV Test Log I-1-1 ").Activate
FileAndLocation = Application.GetSaveAsFilename _
(InitialFileName:=strPathLocation & strFilename, _
filefilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and FileName to save")
ActiveWindow.ScrollWorkbookTabs Sheets:=-16
Sheets("Master").Select
ActiveWorkbook.Save
End Sub