This post has been de-listed (Author was flagged for spam)
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
3
[Save as PDF Question] - Why does this code make my sheets save to My Documents instead of the Workbook directory?
Post Flair (click to view more posts with a particular flair)
Author Summary
GTAIVisbest is
in
Save as PDF Question
Post Body
Here's the Code:
Sub filename_cellvalue()
Dim Path As String
Dim filename As String
Path = "C:\Users\lenovo\Documents\Work\Marketing\Invoicing\Qatar\2018\TempFolder\"
Sheets("Global").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:=Range("A46").Value _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False, From:=1, To:=1
Sheets("City Center").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:=Range("A46").Value _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False, From:=1, To:=1
For some reason, even though I defined a fixed path up top, my two PDF documents keep getting saved to the root "my documents" folder.
The best solution would be some code that could save to the active workbook directory, but I'm not experienced enough to implement that and therefore something that points to a specific directory is the next best thing. I don't want all my documents to get saved to the base my documents folder, though.
Author
Account Strength
0%
Account Age
13 years
Verified Email
Yes
Verified Flair
No
Total Karma
97,708
Link Karma
26,710
Comment Karma
69,365
Profile updated: 7 months ago
Posts updated: 8 months ago
Subreddit
Post Details
Location
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 6 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/excel/comme...