Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change the default print path when creating a PDF file

Status
Not open for further replies.

OlafBogus

Programmer
Oct 1, 2002
77
GB
I need info on how to change the default print path when creating a PDF file through VB. I set the current printer to the PDF printer and then treat it as a standard printer but it always opens a file box with the windows path as the default save path but I need to change it to a network path automatically.
 
I asked the same question last year and got this code from this forum..you may have to modify it to your needs but it works good for me.


Dim wshChangePrinter As IWshNetwork
Dim OldPrinter As String

OldPrinter = Printer.DeviceName 'Current Default Printer
Set wshChangePrinter = New IWshNetwork_Class

wshChangePrinter.SetDefaultPrinter "YourPrinterName" 'Printer you want to make default

wshChangePrinter.SetDefaultPrinter OldPrinter 'Change printer back to original default printer
Set wshChangePrinter = Nothing

Hope this helps

 
sorry missed this..

General Declarations

Private Declare Function SetDefaultPrinter Lib "winspool.drv" Alias "SetDefaultPrinterA" (ByVal PrinterName As String) As Boolean



 
My problem is like this:

Default printer is Xerox 220ST
Change printer to Adobe PDF
Start printing to PDF

I am then asked where I would like to create the PDF file, which always defaults to the windows or temp directory. I need to automatically change file path to somewhere else on the network so I can stop everyone saving files in random locations on their computers
 
adding furthur to your problem ,

i want to pass filename auotmatically .

basically i want to schedule a report at a specific time with specific filename automatically .

i hope i will get help..

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top