save as pdf macro ??? stumped

Copper Contributor

Pretty new at this and I have read and reread so many posts about this topic and cant get it to work.

What I am trying to do is create a macro that will save a copy of active worksheet as a pdf naming the file the same as one particular cell value (I5) which changes with each new invoice therefor no overwriting or duplicate files.  So here is what I have.

 

Sub PDF()

 

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
"C:\Users\17019\Documents\Invoice Copy\" & ActiveSheet.Range("I5").Value & ".pdf", Quality:=xlQualityStandard _
, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False

 

End Sub

 

I have tried several variations' of this to no success. I have also tried to just record a macro to save as PDF that works with a static filename which works fine, but as soon as I try to make that name variable baced on a cell value I fail.

1 Reply

@RKRG5250 

Mail from Excel and make/mail PDF files (Windows)

http://www.rondebruin.nl/win/section1.htm

The third-party products that this article discusses are manufactured by companies or other Persons that are independent of me or I with them. I makes no warranty, implied or otherwise, about the performance or reliability of these products.

 

I got along very well with it :)

 

I would be happy to know if I could help.

 

Nikolino

I know I don't know anything (Socrates)

 

* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community

members reading here.