Macro in MS Word Not Printing Documents in the Order I Selected

In MS Word I print  twelve .RTF  files of various page lengths to produce a consolidated report.  The 12 .RTF files are all in the same directory and are numbered one through twelve.  Using my mouse I can open the directory, open file one, print the report, close the report, open file two, print the report...  When record those mouse clicks into an MS Word macro, the prints do not come out in the order in which I opened and printed them.   I believe that by the time that report number three (11 pages long) loads into the printer, report number twelve (which is one page long) has already loaded into the print buffer first and printed.  Anyway, I'm trying to add a 10 second pause in the macro after each time I click the 'Print' button.   

I added the remarks:

' PAUSE FOR 15 SECONDS STARTS HERE   and

' PAUSE FOR 15 SECONDS ENDS HERE

In anticipation of where I would insert the pause after each report I opened.

Following is a portion of my code for the twelve reports I'm trying to print using a macro. 

I greatly appreciate any assistance you provide.

Sub PRINT_REPORTS()

' PRINT_REPORTS Macro
'
'
    ChangeFileOpenDirectory _
        "\\BLMEILSXF01\shr_Great_Lakes_Ao_Great_Lakes_Ao\finance\Flash\MONDAY FOLDER\MONDAY REPORTS\PRINT FLASH\"
    Documents.Open FileName:= _
        "\\BLMEILSXF01\shr_Great_Lakes_Ao_Great_Lakes_Ao\finance\Flash\MONDAY FOLDER\MONDAY REPORTS\PRINT FLASH\01 AreaRank Week.rtf" _
        , ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
        PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
        WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
        wdOpenFormatAuto, XMLTransform:=""
    ActiveDocument.PrintOut
' PAUSE FOR 15 SECONDS STARTS HERE
' PAUSE FOR 15 SECONDS ENDS HERE
    ActiveWindow.Close
    ChangeFileOpenDirectory _
        "\\BLMEILSXF01\shr_Great_Lakes_Ao_Great_Lakes_Ao\finance\Flash\MONDAY FOLDER\MONDAY REPORTS\PRINT FLASH\"
    Documents.Open FileName:= _
        "\\BLMEILSXF01\shr_Great_Lakes_Ao_Great_Lakes_Ao\finance\Flash\MONDAY FOLDER\MONDAY REPORTS\PRINT FLASH\02 National Flash Week.rtf" _
        , ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
        PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
        WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
        wdOpenFormatAuto, XMLTransform:=""
    ActiveDocument.PrintOut
    ActiveWindow.Close
' PAUSE FOR 15 SECONDS STARTS HERE
' PAUSE FOR 15 SECONDS ENDS HERE
    ChangeFileOpenDirectory _
        "\\BLMEILSXF01\shr_Great_Lakes_Ao_Great_Lakes_Ao\finance\Flash\MONDAY FOLDER\MONDAY REPORTS\PRINT FLASH\"
    Documents.Open FileName:= _
        "\\BLMEILSXF01\shr_Great_Lakes_Ao_Great_Lakes_Ao\finance\Flash\MONDAY FOLDER\MONDAY REPORTS\PRINT FLASH\03 National Flash by Area Week.rtf" _
        , ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
        PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
        WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
        wdOpenFormatAuto, XMLTransform:=""
    ActiveDocument.PrintOut
    ActiveWindow.Close
' PAUSE FOR 15 SECONDS STARTS HERE
' PAUSE FOR 15 SECONDS ENDS HERE

Answer
Answer

Change

ActiveDocument.PrintOut

to

ActiveDocument.PrintOut False

which will interrupt the code until the printing operation of each document is complete

Hope this helps,
Doug Robbins - MVP Office Apps & Services (Word)
dougrobbinsmvp@gmail.com
It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Answer
Answer

You'll have to break up the different sections of your macro into separate subs, then add this line to the bottom of each (except the last):

  Application.OnTime When:=Now + TimeValue("00:00:15"), Name:="NextMacroToRun"
Author of "OOXML Hacking - Unlocking Microsoft Office's Secrets", ebook now out
John Korchok, Production Manager
production@brandwares.com

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated October 5, 2021 Views 234 Applies to: