Goraps
asked on
macro to export call range to pdf
Without specifying a specific folder, my macro should by default save the pdf to “My Documents” on C drive. Macro below:
Sub exportpdf()
ActiveSheet.PageSetup.Prin tArea = "a6:u459"
With ActiveSheet.PageSetup
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Sheets("SKU-Category").Ran ge("a6:u45 9").Export AsFixedFor mat Type:=xlTypePDF, Filename:=Range("I8").Valu e _
, Quality:=xlQualityStandard , IncludeDocProperties:=True , IgnorePrintAreas _
:=False, OpenAfterPublish:=True
End Sub
For some reason, the macro is causing all my pdf to be saved to a folder on the Network drive. I use this folder a lot, but not sure why it’s defaulting to that folder.
If I modify the macro as below it saves it to Desktop but this wouldn’t work for other users I want to send to as I have to specify my user name in the macro. In other words, anyone who is not JohnDoe wouldn’t be able to run the macro.
Sub exportpdf()
ActiveSheet.PageSetup.Prin tArea = "a6:u459"
With ActiveSheet.PageSetup
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Sheets("SKU-Category").Ran ge("a6:u45 9").Export AsFixedFor mat Type:=xlTypePDF, Filename:="C:\Users\jsroy\ Desktop\" & Range("I8").Value _
, Quality:=xlQualityStandard , IncludeDocProperties:=True , IgnorePrintAreas _
:=False, OpenAfterPublish:=True
End Sub
Sub exportpdf()
ActiveSheet.PageSetup.Prin
With ActiveSheet.PageSetup
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Sheets("SKU-Category").Ran
, Quality:=xlQualityStandard
:=False, OpenAfterPublish:=True
End Sub
For some reason, the macro is causing all my pdf to be saved to a folder on the Network drive. I use this folder a lot, but not sure why it’s defaulting to that folder.
If I modify the macro as below it saves it to Desktop but this wouldn’t work for other users I want to send to as I have to specify my user name in the macro. In other words, anyone who is not JohnDoe wouldn’t be able to run the macro.
Sub exportpdf()
ActiveSheet.PageSetup.Prin
With ActiveSheet.PageSetup
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Sheets("SKU-Category").Ran
, Quality:=xlQualityStandard
:=False, OpenAfterPublish:=True
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
"Identify the Location of Special Folders with API Calls"
[ http://msdn.microsoft.com/en-us/library/office/aa140088%28v=office.10%29.aspx ]