HOWTO Make a Word Doc Template do tasks when user goes to print.

A

ATS

HOWTO Make a Word Doc Template do tasks when user goes to print.

Please help, I'm kind of new to VB for Word

I want to make a Word for Windows document template that traps the "onprint"
event to do "things" in the back ground, just after the print has completely
succeeded.

First of all, I can not even slightly find a "onprint" event like "thingy"
in the Word's Macro/VB editor for Word 2000. It should be something like

Sub Document_OnPrint
MsgBox "Hello!!!!"
End Sub

The next thing is how to know that printing succeeded. That is, how to know
that as far as "Word" is concerned, the print job succeeded. It should be
something like this:

Sub Document_OnPrint
Results = Document.~~~Finish~~The~~Print~~Job()

If Result = ~~SUCCESS~~ Then
~~~~ Do My Stuff... ~~~~
End If
End Sub

Lastly, I want (if possible) to "trap" all of the output parameters that
were used for the print job so that I can "duplicate" them into a "background
print job", kind of like this:

Sub Document_OnPrint
PrintJobSettings = Document.Get~~Print~~Job~~Settings
Results = Document.~~~Finish~~The~~Print~~Job()

If Result <> ~~SUCCESS~~ Then
Exit Sub
End

Document.Create~~New~~Print~~Job ~~Pass~~In~~ PrintJobSettings
Results = Document.~~~Finish~~The~~Print~~Job()

If Result <> ~~SUCCESS~~ Then
MsgBox "Oh oh!!!!"
End
End Sub
 
D

Doug Robbins

If you create a macro with the name of one of Word's built in commands, that
macro will run in place of the command when the use attempts to use the
command You can see the names of the commands in the Macros dialog by
selecting the Word Commands item in the Macros in pulldown. In this case,
the ones that you will need are FilePrint and FilePrintDefault. If you set
the Background Print attribute of the .Print command to false, the code that
you want to run after the printing has finished will not run until that
time.

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top