How to schedule printing a Word 2007+ document

Alan VargaAccess Developer
Published:
Updated:
Use Windows Task Scheduler to print a Word document weekly so your printer ink won't dry out.

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:

=====

  • In Trust Center Settings/Trusted Locations check the box to Allow Trusted Locations on my network (even though it's "not recommended")
  • In Trust Center Settings/ActiveX Settings check the button to Enable all controls without restrictions and without prompting (again, even though it's "not recommended")
  • In Trust Center Settings/ActiveX Settings check the box for Safe mode
  • In Trust Center Settings/Macro Settings check the button to Enable all macros (again, "not recommended")
  • In Trust Center Settings/ActiveX Settings check the box to Trust access to the VBA project object model

=====

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

  • change the user to an Administrator account
  • check "Run whether the user is logged on or not"
  • leave "Do not store password" unchecked
  • check "Run with highest privileges"
  • configure for your version of Windows
  • click OK, and provide the administrator account password


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.

0
1,571 Views

Comments (0)

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.