Print to PDF writer and save with custom file name

cubbydaniel

New Member
Joined
May 28, 2010
Messages
3
I have been using this print code but now they want me to save it with longer file name

Loan #_ document id_ document id _ document id_time stamp.pdf

I get the idea of changing the printer but what i dont get is how to get the underlines and how do i tell it to save it with those different document ids i am limited to how many values i can have.



Sub Printsheet()
Sheets("Notes").Range("a1:l91").Select
Application.ActivePrinter = "Microsoft XPS Document Writer on Ne00:"
ThisFile = Range("o6").Value
ThisFile2 = Range("o7").Value2
FileDrive = "C:\Users\El Gordo\Desktop\new folder\"
Selection.PrintOut Copies:=1, ActivePrinter:= _
"Microsoft xps Document Image Writer on ne00:", Collate:=True, _
printtofile:=True, prtofilename:=FileDrive & ThisFile & ThisFile2 & ".xps"
End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,215,339
Messages
6,124,381
Members
449,155
Latest member
ravioli44

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