Macro to PDF Problem

JERRY21

New Member
Joined
Nov 7, 2015
Messages
31
Hi All,

I do have using macro below to save my official receipt in microsoft word as PDF file to be send out to my customer,the problem is when is do have a repetition of same supplier name,the macro cant work it out to save the file individually and error message appear. So can anyone assist me on modify the macro below so that all the same supplier name official receipt can be compile as one pdf file to ease them to see.

Save then resulting document. NOTICE MODIFIED filename
ActiveDocument.SaveAs2 FileName:=Environ("userprofile") + "\Desktop\Output\" + DokName + ".pdf", FileFormat:= _
wdFormatPDF, LockComments:=False, Password:="", AddToRecentFiles _
:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts _
:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False, CompatibilityMode:=14

Thanks You
 
Hi Mr Sergio,
It really work if my invoice number is - but if / the formula Replace does not work in my macro formula and error appear.Can I get your advice?
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
The code I have suggested CHANGES "/" for "-" before you use the receipt as a name to save the PDF like in
filename = Replace(receiptnumber, "/", "-")
You are very close of solving the error but you need to understand your macro better in order to solve the problem by yourself
I cannot give you more advice without the error code/text or the whole macro
Cheers
Sergio
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,873
Members
449,056
Latest member
ruhulaminappu

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