I am looking for help creating a simple Macro for Word 2013 that checks if the user is printing more than 1 copy and cancels the print job.
Some solutions like:
- Forcing it to be 1 copy print job
- MsgBox "You should only select print 1 Copy at a time"
Obviously forcing 1 automatically would be better, but likely more complicated. I figure just a prompt + cancel print job would be easiest and then user can go back and change to print 1 copy.
Reasoning:
I have a macro that prints documents with an incrementing number, but if you select say Print 2 Copies, then the Macro ask's "How many copies" and you say 2, you get 4 documents.
2x Doc # 1
2x Doc # 2
I need to users to ALWAYS select 1 copy in the Word Print Screen then select the # of copies in the Macro Prompt Box.
How can I enforce this?
So my solution involved a flag in
ActiveDocument.PrintOutwhich specifies copiesCopies:=1. This went into the macro that Prints the documents and inside theDocumentBeforePrintI useCancel = True.This allows the user to select whatever number they want in Word and it gets funneled to
Cancel = True, then the Macro ask's "how many copies would you like" and prints X amount of copies incrementing the number each time. Somehow before, even the Macro would take the number of copies set in word and apply it in the macro, so I'd get duplicates of the same serial numbered document which was not what I wanted.I see users putting the same number in both Word and in Macro MsgBox, but really they can just put whatever in Word and it is Only the Macro MsgBox that matters.
The final two code snippets look like this:
Module: