Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Click message box to run macro?

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    359
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Is there anyway to use a message box to run macro?

    MsgBox ("Click to run macro")

    What about having more than one choice on the message box??

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Posts
    255
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    See msgbox function in vb help.

    There are several optional arguments for the function.

    msgbox("Would you like to run the macro?",vbyesno,"Run Macro?")

    Will give you a message box with two buttons. If the person clicks yes, then the function will return the integer 7. So you need an if statement that looks like this:

    If msgbox("Would you like to run the macro?",vbyesno,"Run Macro?")=7 then
    Call RunMacro (or something to call the procedure of the macro). The help menu for this function is very useful and will let you know what other buttons you can add.

    Dave

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •