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
 

Some videos you may like

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Nascobar

New Member
Joined
May 4, 2018
Messages
4
I forgot to mention that I have this code assigned to the 'Vendor PDF button' on worksheet.
 

Nascobar

New Member
Joined
May 4, 2018
Messages
4
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
 

BigDawg15

New Member
Joined
Apr 23, 2018
Messages
28
Office Version
  1. 2016
Platform
  1. Windows
Nascobar,

try changing file name to:

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

Regards,

BigDawg15
 

BigDawg15

New Member
Joined
Apr 23, 2018
Messages
28
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

Sorry,

Should be a \ after 2018 and before the end quote.
 

BigDawg15

New Member
Joined
Apr 23, 2018
Messages
28
Office Version
  1. 2016
Platform
  1. Windows
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
 

BigDawg15

New Member
Joined
Apr 23, 2018
Messages
28
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

Last time really:

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

BigDawg15

New Member
Joined
Apr 23, 2018
Messages
28
Office Version
  1. 2016
Platform
  1. Windows
Code:
"Q:\Michael\PO's\2018\" & Range("C10").value & "_" & Format(Range("H5").value, "mm-dd-yyyy") & ".pdf"
 

Nascobar

New Member
Joined
May 4, 2018
Messages
4
Yes! Exactly what I wanted. Going to save my folks a lot of time.

Thanks so much BigDawg! I really appreciate the help.
 

BigDawg15

New Member
Joined
Apr 23, 2018
Messages
28
Office Version
  1. 2016
Platform
  1. Windows
Glad I could help.

Thanks for the feed back!
 

Watch MrExcel Video

Forum statistics

Threads
1,109,072
Messages
5,526,640
Members
409,713
Latest member
roman9980

This Week's Hot Topics

Top