Computing.Net > Forums > Programming > windows scripting to print

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

windows scripting to print

Reply to Message Icon

Original Message
Name: pushcode
Date: February 20, 2004 at 08:52:55 Pacific
Subject: windows scripting to print
OS: win2000
CPU/Ram: pIII
Comment:

The following script and batch code work together to allow me to automatically print a word document when the batch file is executed. The only problem is that it currently prints to the default printer of the user who executes the batch file.
I need to be able to use a specific printer, not the user's default.
Does anyone know what script I need to be able to make it print to a specific printer?
The printer name and location is: "\\ds2\Konica 7060PS Back"

Here's the vbs script and batch file:

----- start wordprint.vbs file ------------
Set WordApp = CreateObject("Word.Application")

WordApp.Documents.Open(WScript.Arguments.Item(0))

WordApp.ActiveDocument.PrintOut False
WordApp.ActiveDocument.Close False
WordApp.Quit

Set WordApp = Nothing
---- end wordprint.vbs file -------------

----- start Batch file ------------
start \\devweb01\docs\wordprint.vbs \\devweb01\docs\test.rtf
----- end Batch file ------------

Any ideas?


Report Offensive Message For Removal


Response Number 1
Name: IVO
Date: February 21, 2004 at 14:04:35 Pacific
Reply: (edit)

Before

WordApp.ActiveDocument.PrintOut False

Add (one line statement)

WordApp.WordBasic.FilePrintSetup("\\ds2\Konica 7060PS Back",,,1)

assuming "\\ds2\Konica 7060PS Back" is the UNC of your target printer.

I hope this solves your My Day as I am out of my resources.



Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software