+ Reply to Thread
Results 1 to 4 of 4

Adding a Message Box to start a Macro

  1. #1
    kyle
    Guest

    Adding a Message Box to start a Macro

    I have a toolbar set up with my workbook and I would like to add in some
    safegaurds so an error doesn't happen. How would I write a macro so that
    when they clicked the toolbar button it brought up a message that stated,
    something to the effect of "have you updated the Manager page?". Then the
    box would have two buttons Yes and No. If they click Yes, I would like it to
    run the macro. If they click No, I would like it to not run the macro.

    Thanks,
    Kyle

  2. #2
    Bob Phillips
    Guest

    Re: Adding a Message Box to start a Macro

    Sub ButtonMacro()
    Dim ans As Long

    ans = MsgBox("have you updated the Manager page?",vbYesNo

    If ans = vbYes Then
    'do your stuff
    End If

    End SUb


    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "kyle" <[email protected]> wrote in message
    news:[email protected]...
    > I have a toolbar set up with my workbook and I would like to add in some
    > safegaurds so an error doesn't happen. How would I write a macro so that
    > when they clicked the toolbar button it brought up a message that stated,
    > something to the effect of "have you updated the Manager page?". Then the
    > box would have two buttons Yes and No. If they click Yes, I would like it

    to
    > run the macro. If they click No, I would like it to not run the macro.
    >
    > Thanks,
    > Kyle




  3. #3
    Jim Jackson
    Guest

    RE: Adding a Message Box to start a Macro

    If Msgbox("have you updated the Manager page?", vbYesNo) = vbNo then
    Exit Sub
    else
    end if
    (continues running the code)

    Jim


    "kyle" wrote:

    > I have a toolbar set up with my workbook and I would like to add in some
    > safegaurds so an error doesn't happen. How would I write a macro so that
    > when they clicked the toolbar button it brought up a message that stated,
    > something to the effect of "have you updated the Manager page?". Then the
    > box would have two buttons Yes and No. If they click Yes, I would like it to
    > run the macro. If they click No, I would like it to not run the macro.
    >
    > Thanks,
    > Kyle


  4. #4
    crazybass2
    Guest

    RE: Adding a Message Box to start a Macro

    Jim,

    Nice! Shorter than Bob's. Heck it could even be a one liner IF. Never
    thought of putting a MSGBOX in the IF. I've always gone Bob's way.

    Mike

    "Jim Jackson" wrote:

    > If Msgbox("have you updated the Manager page?", vbYesNo) = vbNo then
    > Exit Sub
    > else
    > end if
    > (continues running the code)
    >
    > Jim
    >
    >
    > "kyle" wrote:
    >
    > > I have a toolbar set up with my workbook and I would like to add in some
    > > safegaurds so an error doesn't happen. How would I write a macro so that
    > > when they clicked the toolbar button it brought up a message that stated,
    > > something to the effect of "have you updated the Manager page?". Then the
    > > box would have two buttons Yes and No. If they click Yes, I would like it to
    > > run the macro. If they click No, I would like it to not run the macro.
    > >
    > > Thanks,
    > > Kyle


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1