Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Karin Karin is offline
external usenet poster
 
Posts: 40
Default Msg Box at end of Macro

Hi,

I'd like to put a message box at the end of a macro indicating that the
macro ran. Can someone help me, I keep getting compile errors.
(Expected =)

MsgBox(prompt:="Verbiage Changed", Buttons:=vbOkOnly, Title:="Finished")

TIA!

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Lene Fredborg Lene Fredborg is offline
external usenet poster
 
Posts: 1,291
Default Msg Box at end of Macro

Leave out the parenthesis:

MsgBox Prompt:="Verbiage Changed", Buttons:=vbOKOnly, Title:="Finished"

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


"Karin" wrote:

Hi,

I'd like to put a message box at the end of a macro indicating that the
macro ran. Can someone help me, I keep getting compile errors.
(Expected =)

MsgBox(prompt:="Verbiage Changed", Buttons:=vbOkOnly, Title:="Finished")

TIA!

  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Msg Box at end of Macro

Karin wrote:
Hi,

I'd like to put a message box at the end of a macro indicating that
the macro ran. Can someone help me, I keep getting compile errors.
(Expected =)

MsgBox(prompt:="Verbiage Changed", Buttons:=vbOkOnly,
Title:="Finished")

TIA!


Just remove the parentheses, leaving a space between MsgBox and prompt.

The explanation (sort of) is at
http://www.word.mvps.org/FAQs/Macros...ithArgmnts.htm. By
including parentheses around the parameter list, you're implying to VBA that
it's a function (part 2 of the article), and a function has to be on the
right side of an equal sign so that its return value can be put somewhere.
That's why it says it's expecting an equal sign.

Because you aren't using any return value, you're calling MsgBox as a sub
(part 3 of the article), which means you shouldn't have parentheses.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Spell Check a protected Form with a Macro & already have forms picture macro [email protected] Microsoft Word Help 2 October 25th 07 04:11 PM
Macro cannot be found or has been disabled because of Macro settin JD2 Microsoft Word Help 5 March 15th 07 04:00 AM
Pause an executing Word Macro to enter info and then Macro continu strongwell Microsoft Word Help 1 August 11th 06 06:57 PM
macro runs from keyboard, but not from macro button-why? BobW Microsoft Word Help 7 May 10th 06 11:33 PM
2000 to 2002 macro and "Could not open macro storage" Art Farrell Mailmerge 1 December 6th 04 12:40 PM


All times are GMT +1. The time now is 02:38 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"