Saving a PDF using cell refrences

Nascobar

New Member
Joined
May 4, 2018
Messages
4
I am using Excel 2013.

I'm close to achieving the result I want but I need some help. Please, before it drives me insane. Lol. I have made a Purchase Order Sheet that auto-fills a lot of information based on the vendor chosen in a drop-down list in cell 'C10'. It also has the current date in cell 'H5' (pic below). What I would like to happen is the document save as a PDF in the folder Q:\Michael\PO's\2018 with the name of the vendor chosen in 'C10' followed by an underscore '_' then the date from cell 'H5' in mm-dd-yyyy format like this - Arizona Forklift Parts_05-04-2018.pdf

I know the way it is now is wrong so if I could get some assistance I would appreciated it. There may be some extra code in there I don't need as well because I have been trying to piece together and figure it out for quite awhile now.


Code:
Sub vendorPDF()
'
' vendorPDF Macro
'




'
Dim strFilename As String
Dim strpath As String




Application.DisplayAlerts = False




ActiveSheet.Unprotect Password = ""
Application.Goto Reference:="Print_Area_Vendor"
Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
[COLOR=#ff0000]"Q:\Michael\PO's\2018\Range("C10")"_vendor.pdf"[/COLOR], Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, From:=1, To:=1, _
OpenAfterPublish:=True
Range("C14:E14").Select
ActiveSheet.Protect
End Sub




Thanks in advance,
Michael
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
BUMP
I would appreciate any help I could get on this. I need to get it set for my people to use tomorrow. Thanks for the look.

Michael
 
Upvote 0
Nascobar,

try changing file name to:

"Q:\Michael\PO's\2018" & Range("C10").value & "_Format(Range("H5").value, "mm-dd-yyyy") .pdf"

Regards,

BigDawg15
 
Upvote 0
Sorry,

Should be a \ after 2018 and before the end quote.
 
Upvote 0
OK last time, here ya go:

"Q:\Michael\PO's\2018" & Range("C10").value & "_" & Format(Range("H5").value, "mm-dd-yyyy") & ".pdf"

Sorry about the confusion.


BigDawg15
 
Upvote 0
Last time really:

"Q:\Michael\PO's\2018" & Range("C10").value & "_" & Format(Range("H5").value, "mm-dd-yyyy") & ".pdf"
 
Upvote 0
Code:
"Q:\Michael\PO's\2018\" & Range("C10").value & "_" & Format(Range("H5").value, "mm-dd-yyyy") & ".pdf"
 
Upvote 0
Yes! Exactly what I wanted. Going to save my folks a lot of time.

Thanks so much BigDawg! I really appreciate the help.
 
Upvote 0

Forum statistics

Threads
1,223,970
Messages
6,175,703
Members
452,667
Latest member
vanessavalentino83

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