Save .pdf in specific location

hkelly

New Member
Joined
Aug 11, 2008
Messages
5
I have this which works great...except for the file location. For some reason it's forcing the file save to c:\users\username\documents

I ultimately don't want it in Downloads at all but I'm using this path for testing. I'm sure it's obvious but I'm clearly missing something.

Anyone help? It otherwise saves the file name as I want it and as a .pdf which is perfect.


Sub printPDFSave()
Dim rng As Range
Dim fPath As String
Dim FName As String

Set rng = [Print_Area]
rng.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fPath, quality:=xlQualityStandard, _
includedocproperties:=True, ignoreprintareas:=False, openafterpublish:=True
fPath = "C:\Users\username\Downloads"
FName = Format(Date, "yyyymmdd""-") & Sheets("MHGRIC").Range("BP2").Text



End Sub
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Actually, I lied! It's not working great at all. The file name isn't saving as designed. I was looking at a different file I saved previously.

Goal: Save as a specific name using data from a cell within my sheet and to a specific location on my computer.
 
Upvote 0
Maybe:
Code:
fPath = "C:\path\to\folder\"  'CHANGE THIS
If Right(fPath,1) <> "\" Then fPath = fPath & "\"
FName = Format(Date, "yyyymmdd-") & Sheets("MHGRIC").Range("BP2").Text
rng.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fPath & FName, quality:=xlQualityStandard, _
includedocproperties:=True, ignoreprintareas:=False, openafterpublish:=True
 
Upvote 0

Forum statistics

Threads
1,214,629
Messages
6,120,630
Members
448,973
Latest member
ChristineC

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top