Hello All,
I have a VBA code that is written to save the cells from range "G66:K95" of the currently active sheet as a PDF file. The name of the sheet is used as the file name, and the file is saved in a subfolder within the same directory as the workbook.
It all works well EXCEPT, the file is not saved to a subfolder within the same directory as the workbook, instead it is saving to the last location that any file was saved to. Anyone got any ideas ? Thanks in advance
Save the selected cells as a PDF file with the sheet name as the file name
Dim sheetName As String
sheetName = ActiveSheet.Name
Dim savePath As String
savePath = ThisWorkbook.Path & "\Variations\" & sheetName & ".pdf"
ActiveSheet.Range("G66:K95").ExportAsFixedFormat Type:=xlTypePDF, _
fileName:=sheetName, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
I have a VBA code that is written to save the cells from range "G66:K95" of the currently active sheet as a PDF file. The name of the sheet is used as the file name, and the file is saved in a subfolder within the same directory as the workbook.
It all works well EXCEPT, the file is not saved to a subfolder within the same directory as the workbook, instead it is saving to the last location that any file was saved to. Anyone got any ideas ? Thanks in advance
Save the selected cells as a PDF file with the sheet name as the file name
Dim sheetName As String
sheetName = ActiveSheet.Name
Dim savePath As String
savePath = ThisWorkbook.Path & "\Variations\" & sheetName & ".pdf"
ActiveSheet.Range("G66:K95").ExportAsFixedFormat Type:=xlTypePDF, _
fileName:=sheetName, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False