Hello everyone
I am trying to create individual pdf file for three active sheets (Report1, Report2 and Report3) and want to save them in the same folder as where the current excel workbook is saved. i have codes below and the pdf files are created okay but they are being saved in different folder. i cant figure it out why and how to fix it. can you please help?
I have saved the workbook and closed and re-opened it and the pdf files are still saved in the wrong place....
Thank you in advance!
*here are some background which might help you to help me...
i normally create the following month workbook by changing file name of previous month excel workbook and created a new folder for the month i am working and saved them. i want the pdf files to be saved in the THAT folder i created not previous folder!
Codes that i have at the moment are...
Sheets("Report1").Select
Dpath = "Report1" & Format(Range("h7"), "mmmm yyyy")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Dpath, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
Sheets("report2").Select
Dpath = "Report2" & Format(Range("h7"), "mmmm yyyy")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Dpath, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
Sheets("report3").Select
Dpath = "Report3 " & Format(Range("h7"), "mmmm yyyy")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Dpath, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
I am trying to create individual pdf file for three active sheets (Report1, Report2 and Report3) and want to save them in the same folder as where the current excel workbook is saved. i have codes below and the pdf files are created okay but they are being saved in different folder. i cant figure it out why and how to fix it. can you please help?
I have saved the workbook and closed and re-opened it and the pdf files are still saved in the wrong place....
Thank you in advance!
*here are some background which might help you to help me...
i normally create the following month workbook by changing file name of previous month excel workbook and created a new folder for the month i am working and saved them. i want the pdf files to be saved in the THAT folder i created not previous folder!
Codes that i have at the moment are...
Sheets("Report1").Select
Dpath = "Report1" & Format(Range("h7"), "mmmm yyyy")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Dpath, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
Sheets("report2").Select
Dpath = "Report2" & Format(Range("h7"), "mmmm yyyy")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Dpath, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
Sheets("report3").Select
Dpath = "Report3 " & Format(Range("h7"), "mmmm yyyy")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Dpath, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True