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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scheduling a MS Word document to print

Status
Not open for further replies.

DayLaborer

Programmer
Jan 3, 2006
347
US
Know how you can right-click on a MS Word file and choose "Print" from the context menu and Windows quickly opens Word, prints the document, then closes Word? Is it possible to schedule a task through Windows (XP Pro) to do exactly that, for let's say this document:
[tt]C:\PrintMeEveryMorning.doc[/tt]

Thanks,
Eliezer
 
You will have to start with a Scheduled Task. This means you will need to be able to perform the required tasks (launch Word, open doc, print doc, close doc, close Word) from the command line.

I was going to suggest that you look at the command line options Windows uses when you right-click and choose Print. But that uses DDE which I don't understand (perhaps someone else does and could suggest a solution based on that).

So instead I would approach it by writing a small macro which opens the document, prints it using the default printer, closes it (without saving) and closes Word.

Your scheduled task can then call Word using the /mmacro_name switch to launch Word and run the macro you wrote. See for more info on the command line switches for the various versions of Word.

Please note that I have never tried this - it's just my initial idea for a possible solution. Good luck.
 
I hate to sound stupid, but...
DUH...
After reading and visiting those links, I still cannot figure out how to do this...

Any compassionate people who can give me remedial assistance on this?

Thanks,
Eliezer
 
I would think there would be some sort of switch command to open an MS Word file to print, but I cannot find one. Can anyone help me with this?

Thanks,
Eliezer
 
Using the file printdoc_vbs.txt from linney's post
Rename the file printdoc.vbs

You can test with the "Run" command:

Code:
(path to file)\printdoc.vbs (path to file)\WordDoc.doc

You can but the above command in a batch file (.bat) or commmand file (.cmd)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top