+ Reply to Thread
Results 1 to 6 of 6

Macro prompts user to run macro?

  1. #1
    Registered User
    Join Date
    06-27-2005
    Posts
    22

    Question Macro prompts user to run macro?

    Is there any way I can set a "open macro" to ask the user if they would like to "update flags" run a seperate macro?

    I have it set where the workbook runs a macro on open to update the flags, but if they have already opened it recently then they probably don't need to update the flags again, so I would like to give them a prompt where they can so yes or no to the update and not have to wait on the macro to run everytime.

    Any suggestions...?

    Thanks

  2. #2
    Registered User
    Join Date
    10-19-2005
    Posts
    1
    Use a message box to get the choice from the user, here's a sample.

    Dim intYN As Integer
    intYN = MsgBox("Do you want to update flags?", vbYesNo, "Update Flags")
    If intYN = 6 then
    [DoIt]
    Else
    [Don't]
    End If

  3. #3
    Registered User
    Join Date
    06-27-2005
    Posts
    22

    Almost...

    It did prompt me, but it ran the macro no matter which you chose.
    Anymore help???

    Thanks

    Quote Originally Posted by Brett0769
    Use a message box to get the choice from the user, here's a sample.

    Dim intYN As Integer
    intYN = MsgBox("Do you want to update flags?", vbYesNo, "Update Flags")
    If intYN = 6 then
    [DoIt]
    Else
    [Don't]
    End If

  4. #4
    Jim Thomlinson
    Guest

    Re: Macro prompts user to run macro?

    Give this a try...

    If MsgBox("Do you want to update flags?", vbYesNo, "Update
    Flags") = vbYes then
    [DoIt]
    Else
    [Don't]
    End If

    --
    HTH...

    Jim Thomlinson


    "miwarren" wrote:

    >
    > It did prompt me, but it ran the macro no matter which you chose.
    > Anymore help???
    >
    > Thanks
    >
    > Brett0769 Wrote:
    > > Use a message box to get the choice from the user, here's a sample.
    > >
    > > Dim intYN As Integer
    > > intYN = MsgBox("Do you want to update flags?", vbYesNo, "Update
    > > Flags")
    > > If intYN = 6 then
    > > [DoIt]
    > > Else
    > > [Don't]
    > > End If

    >
    >
    > --
    > miwarren
    > ------------------------------------------------------------------------
    > miwarren's Profile: http://www.excelforum.com/member.php...o&userid=24682
    > View this thread: http://www.excelforum.com/showthread...hreadid=477638
    >
    >


  5. #5
    Registered User
    Join Date
    06-27-2005
    Posts
    22

    Getting error msg...

    When I input this into the module it immediately gives me a compile error message.
    "Expected: line number or label or statement or end of statment

    HELP?


    Quote Originally Posted by Jim Thomlinson
    Give this a try...

    If MsgBox("Do you want to update flags?", vbYesNo, "Update
    Flags") = vbYes then
    [DoIt]
    Else
    [Don't]
    End If

    --
    HTH...

    Jim Thomlinson


    "miwarren" wrote:

    >
    > It did prompt me, but it ran the macro no matter which you chose.
    > Anymore help???
    >
    > Thanks
    >
    > Brett0769 Wrote:
    > > Use a message box to get the choice from the user, here's a sample.
    > >
    > > Dim intYN As Integer
    > > intYN = MsgBox("Do you want to update flags?", vbYesNo, "Update
    > > Flags")
    > > If intYN = 6 then
    > > [DoIt]
    > > Else
    > > [Don't]
    > > End If

    >
    >
    > --
    > miwarren
    > ------------------------------------------------------------------------
    > miwarren's Profile: http://www.excelforum.com/member.php...o&userid=24682
    > View this thread: http://www.excelforum.com/showthread...hreadid=477638
    >
    >

  6. #6
    Registered User
    Join Date
    06-27-2005
    Posts
    22

    Thought I figured it out...? Guess not

    I made some changes and now it doesn't run the macro no matter which you pick. I will just post the code and maybe someone can tell me where I am going wrong. Thanks

    Please Login or Register  to view this content.
    Quote Originally Posted by Jim Thomlinson
    Give this a try...

    If MsgBox("Do you want to update flags?", vbYesNo, "Update
    Flags") = vbYes then
    [DoIt]
    Else
    [Don't]
    End If

    --
    HTH...

    Jim Thomlinson


    "miwarren" wrote:

    >
    > It did prompt me, but it ran the macro no matter which you chose.
    > Anymore help???
    >
    > Thanks
    >
    > Brett0769 Wrote:
    > > Use a message box to get the choice from the user, here's a sample.
    > >
    > > Dim intYN As Integer
    > > intYN = MsgBox("Do you want to update flags?", vbYesNo, "Update
    > > Flags")
    > > If intYN = 6 then
    > > [DoIt]
    > > Else
    > > [Don't]
    > > End If

    >
    >
    > --
    > miwarren
    > ------------------------------------------------------------------------
    > miwarren's Profile: http://www.excelforum.com/member.php...o&userid=24682
    > View this thread: http://www.excelforum.com/showthread...hreadid=477638
    >
    >

+ 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