CutePDF default name

jsambrook

Board Regular
Joined
Feb 1, 2010
Messages
214
I'm printing to PDF as part of a macro and I want to insert a default name for the file. what code do I need to do this?
thanks
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
What's your code look like?
What do you want the default name to be?
 
Upvote 0
Code looks like this

Code:
        Application.ActivePrinter = "CutePDF Writer on CPW2:"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
        "CutePDF Writer on CPW2:", Collate:=True
    Application.ActivePrinter = "RICOH Aficio 3228C PCL 5c on Ne00:"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
        "RICOH Aficio 3228C PCL 5c on Ne00:", Collate:=True

I want to save the filename as a combination of date and time and also a number from a cell.

thanks
 
Upvote 0
Thanks, looks complicated!
Do you recommend replacing the print to pdf code with the example then? Not sure I follow all the .ps part of the code?
Do I need all of it do you think?
thanks again.
 
Upvote 0
I don't have CutePDF writer here, so I am not sure. But I think you may be able to just get away with adding that single argument to the end of your Print statement. Give it a shot with a simple test first to see if it works. If it does, then you can tackle building the dynamic file name instead of using a hard-code name.

So the change to that one command may look something like this:
Code:
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
    "CutePDF Writer on CPW2:", Collate:=True, PrToFileName:="C:\MyTest.pdf"
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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