save as pdf macro ??? stumped

%3CLINGO-SUB%20id%3D%22lingo-sub-1693976%22%20slang%3D%22en-US%22%3Esave%20as%20pdf%20macro%20%3F%3F%3F%20stumped%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1693976%22%20slang%3D%22en-US%22%3E%3CP%3EPretty%20new%20at%20this%20and%20I%20have%20read%20and%20reread%20so%20many%20posts%20about%20this%20topic%20and%20cant%20get%20it%20to%20work.%3C%2FP%3E%3CP%3EWhat%20I%20am%20trying%20to%20do%20is%20create%20a%20macro%20that%20will%20save%20a%20copy%20of%20active%20worksheet%20as%20a%20pdf%20naming%20the%20file%20the%20same%20as%20one%20particular%20cell%20value%20(I5)%20which%20changes%20with%20each%20new%20invoice%20therefor%20no%20overwriting%20or%20duplicate%20files.%26nbsp%3B%20So%20here%20is%20what%20I%20have.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESub%20PDF()%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EActiveSheet.ExportAsFixedFormat%20Type%3A%3DxlTypePDF%2C%20FileName%3A%3D%20_%3CBR%20%2F%3E%22C%3A%5CUsers%5C17019%5CDocuments%5CInvoice%20Copy%5C%22%20%26amp%3B%20ActiveSheet.Range(%22I5%22).Value%20%26amp%3B%20%22.pdf%22%2C%20Quality%3A%3DxlQualityStandard%20_%3CBR%20%2F%3E%2C%20IncludeDocProperties%3A%3DTrue%2C%20IgnorePrintAreas%3A%3DFalse%2C%20OpenAfterPublish%3A%3D%20_%3CBR%20%2F%3EFalse%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEnd%20Sub%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20tried%20several%20variations'%20of%20this%20to%20no%20success.%20I%20have%20also%20tried%20to%20just%20record%20a%20macro%20to%20save%20as%20PDF%20that%20works%20with%20a%20static%20filename%20which%20works%20fine%2C%20but%20as%20soon%20as%20I%20try%20to%20make%20that%20name%20variable%20baced%20on%20a%20cell%20value%20I%20fail.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1693976%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1694262%22%20slang%3D%22de-DE%22%3ESubject%3A%20save%20as%20pdf%20macro%20%3F%3F%3F%20stumped%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1694262%22%20slang%3D%22de-DE%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F801827%22%20target%3D%22_blank%22%3E%40RKRG5250%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CH2%20id%3D%22toc-hId--1264910663%22%20id%3D%22toc-hId--1264910663%22%3EMail%20from%20Excel%20and%20make%2Fmail%20PDF%20files%20(Windows)%3C%2FH2%3E%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fwww.rondebruin.nl%2Fwin%2Fsection1.htm%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttp%3A%2F%2Fwww.rondebruin.nl%2Fwin%2Fsection1.htm%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%222%22%3EThe%20third-party%20products%20that%20these%20article%20discusses%20are%20manufactured%20by%20companies%20or%20other%20persons%20that%20are%20independent%20of%20me%20or%20I%20with%20them.%20I%20makes%20no%20warranty%2C%20implied%20or%20otherwise%2C%20about%20the%20performance%20or%20reliability%20of%20these%20products.%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22tlid-translation%20translation%22%3E%3CSPAN%20class%3D%22%22%3EI%20got%20along%20very%20well%20with%20it%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20be%20happy%20to%20know%20if%20I%20could%20help.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENikolino%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%222%22%3E*%20Kindly%20Mark%20and%20Vote%20this%20reply%20if%20it%20helps%20please%2C%20as%20it%20will%20be%20beneficial%20to%20more%20community%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%222%22%3EMembers%20reading%20here.%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

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.