Message Box in Word

Z

Zack Mayo

I am not a programmer but need to have a Word template display a message box
when the user clicks the print button. Can this be done. I need the box to
inform them that they need to have the form signed before it is faxed.

Any info would be great..
 
J

Jay Freedman

Zack said:
I am not a programmer but need to have a Word template display a
message box when the user clicks the print button. Can this be done.
I need the box to inform them that they need to have the form signed
before it is faxed.

Any info would be great..

See http://word.mvps.org/FAQs/MacrosVBA/InterceptSavePrint.htm. In step 4 of
the procedure, you can insert a MsgBox statement before the print command,
like this:

Sub FilePrint()
'
' FilePrint Macro
' Prints the active document
'
MsgBox "You must have the form signed before it is faxed."
Dialogs(wdDialogFilePrint).Show

End Sub

Do the same for the FilePrintDefault command, which is what runs when you
click the Print button on the toolbar.
 
Z

Zack Mayo

It seemed to work pretty good until I saved it as a template. Should that
make a difference?
 
J

Jay Freedman

Hi Zack,

If you stored the macro in the template, and then you used File > New to
make a new document based on that template, the macro will still work.

Can you give me a complete description of the steps you did, starting with
making the macros, and what you saw?

Are you sure the macro is in the template? Here are two ways to tell:

- Open the Tools > Macro > Macros dialog. Set the "Macros in" box to the
name of the template. Do the FilePrint and FilePrintDefault macros appear in
the list?

- Open the macro editor (Alt+F11). If you don't see the Projects pane on the
left, press F4. Find the project with the template's name next to it. If
necessary, click the + sign to expand that icon. Expand the Modules icon
under that. There should be a NewMacros icon there -- double-click it. Does
the code of the macros appear in the editing window on the right?
 
Z

Zack Mayo

They are there. I get the following error when I hit print:

The macros in this project are disabled. Please refer to the online help or
documentation of the host application to determine how to enable macros.

Thanks for your help.
 
J

Jay Freedman

Look in the Tools > Macro > Security dialog, on the Trusted Sources tab.
Check the box for "Trust all installed add-ins and templates". Then make
sure the template is stored in the Templates folder (the one indicated in
the Tools > Options > File Locations dialog as the "User Templates"
location), which is a trusted location.
 

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