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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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