Shaves
Shaves

Reputation: 930

Excel macro / documents printing out of order

I have an Excel based macro that opens a Word document, fills in some info, prints the document, and saves the Word document to a specific folder. Then it opens a 2nd Word document and completes the same steps. Then it opens a 3rd document and completes the same steps.

The macro was developed in Excel / Word 2010. It has been working great; meaning all of the sheets were printed in the order they were processed: Doc 1, Doc 2, Doc 3 and over and over. The user never had to sort the printed documents.

Life was good until they got converted to Office 365. Now the documents appear to be printed in some random order. This means the user now has to sort all of the documents to get the 3 documents grouped together.

They have noticed that sometimes the printer properties will say "spooling". She claims that once she sees this status, that is when they start printing in some random order.

Here is the part of the code where the document is printed and saved:

WrdApp.ActiveDocument.PrintOut

WrdApp.ActiveDocument.SaveAs2 Filename:=FilePath2 & Var3(y) & " - Page 1 - Lease Exemption.docx", _
FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", _
AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _
:=False, SaveAsAOCELetter:=False, CompatibilityMode:=14

WrdDoc.Close

This code is the same for all 3 modules (1 for each document).

Any suggestions to help resolve the printing / sorting issue would be greatly appreciated. Thanks for your help.........

Upvotes: 0

Views: 505

Answers (2)

macropod
macropod

Reputation: 13515

Simply turn off background printing:

Options.PrintBackground = False

Upvotes: 0

Victor Burnett
Victor Burnett

Reputation: 628

It sounds like a printer spooling error:

"The print spooler helps your Windows computer interact with the printer, and orders the print jobs in your queue. If you see any error message about the print spooler, this tool has been corrupted or is failing to interact correctly with other software. You may need to try more than one method to fix the spooler."

It may be that your current printer software/driver needs to be updated.

This article might help as well: https://www.wikihow.com/Fix-a-Print-Spooler

Upvotes: 0

Related Questions