Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / June 2005

Tip: Looking for answers? Try searching our database.

Message Box in Word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Zack Mayo - 28 Jun 2005 14:46 GMT
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..
Jay Freedman - 28 Jun 2005 15:41 GMT
> 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.

Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

Zack Mayo - 28 Jun 2005 18:51 GMT
It seemed to work pretty good until I saved it as a template. Should that
make a difference?

> > 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.
[quoted text clipped - 19 lines]
> Do the same for the FilePrintDefault command, which is what runs when you
> click the Print button on the toolbar.
Jay Freedman - 28 Jun 2005 21:01 GMT
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?

Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

> It seemed to work pretty good until I saved it as a template. Should
> that make a difference?
[quoted text clipped - 27 lines]
>> Jay Freedman
>> Microsoft Word MVP          FAQ: http://word.mvps.org
Zack Mayo - 29 Jun 2005 13:34 GMT
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.

> Hi Zack,
>
[quoted text clipped - 47 lines]
> >> Jay Freedman
> >> Microsoft Word MVP          FAQ: http://word.mvps.org
Jay Freedman - 29 Jun 2005 17:31 GMT
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.

Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

> They are there. I get the following error when I hit print:
>
[quoted text clipped - 62 lines]
>>>> Jay Freedman
>>>> Microsoft Word MVP          FAQ: http://word.mvps.org

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.