This should work for Word 2007+. Older articles mention a way to start Word, but they imply the functionality to print a document to the default printer is automatically built in; it is not.
The location of options will change depending on which version of Word you are using, but here's the general idea:
=====
=====
Open your test document (.docx) and re-save it as a macro-enabled document (.docm). Use Alt+F11 to open the Visual Basic for Applications environment and insert a new module (NOT a class module). In the module paste this text:
Option Explicit
Sub FilePrintDefault()
ActiveDocument.PrintOut
Application.Quit
End Sub ' FilePrintDefault
Save the module and save the document.
To test, use Alt+F8 to run the macro FilePrintDefault. Word will print the document and then quit.
=====
As found on other Internet sources, you can now paste this line in a text command file (e.g. "HP testprint.cmd") and edit it for your version of Word, and whatever your test document name is.
"%ProgramFiles(x86)%\Microsoft Office\Office14\WINWORD.EXE" /mFilePrintDefault "\\whserver02\Public\Printers\RGB HP Deskjet 3000 datetime.docm"
This will open your document in Word and run the macro, which includes the instruction to quit. (Otherwise your print spooler may get messed up, which frustrated me for a long time.)
To test, run the command file from a command prompt (Win+R, "cmd"). Word will print the document and then quit.
=====
Finally, create a scheduled task. To make changes you will need the Properties window available.
On the Actions tab choose the action to start a program. The name of the command file will be the Program/Script to run. No arguments are needed; any of that is contained in the command file.
On the General tab
To test, run the task immediately.
To test further, change the Triggers time to one minute past current for today and wait for the test document to print and close Word. If successful, change the Trigger back to the desired schedule.
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (0)