+ Reply to Thread
Results 1 to 3 of 3

macros -"OK buttons" part way through ?

  1. #1
    Registered User
    Join Date
    11-09-2005
    Posts
    6

    macros -"OK buttons" part way through ?

    Is it possible to create a macro that
    -displays a message window, and
    -requires the user to click on an OK button,
    before the macro can finish?

    If so, how is it done?

    Or does it need to be done with separate macros, one to start the process, and one that is activated when you click on an OK button created by the first macro?

    Thanks in advance for any help.

  2. #2
    Ardus Petus
    Guest

    Re: macros -"OK buttons" part way through ?

    Try:
    Msgbox "Press OK to continue"

    HTH
    --
    AP

    "dyl" <[email protected]> a écrit dans le
    message de news:[email protected]...
    >
    > Is it possible to create a macro that
    > -displays a message window, and
    > -requires the user to click on an OK button,
    > before the macro can finish?
    >
    > If so, how is it done?
    >
    > Or does it need to be done with separate macros, one to start the
    > process, and one that is activated when you click on an OK button
    > created by the first macro?
    >
    > Thanks in advance for any help.
    >
    >
    > --
    > dyl
    > ------------------------------------------------------------------------
    > dyl's Profile:

    http://www.excelforum.com/member.php...o&userid=28671
    > View this thread: http://www.excelforum.com/showthread...hreadid=518638
    >




  3. #3
    Forum Contributor
    Join Date
    02-12-2006
    Location
    London UK
    Posts
    109
    Quote Originally Posted by dyl
    Is it possible to create a macro that
    -displays a message window, and
    -requires the user to click on an OK button,
    before the macro can finish?

    If so, how is it done?

    Or does it need to be done with separate macros, one to start the process, and one that is activated when you click on an OK button created by the first macro?

    Thanks in advance for any help.
    Yes you can, by using a message window to request a response from a user - and do whatever you want depending upon the response. If you check out VBA help on message boxes you get the following example:
    --------------------
    Dim Msg, Style, Title, Help, Ctxt, Response, MyString
    Msg = "Do you want to continue ?" ' Define message.
    Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
    Title = "MsgBox Demonstration" ' Define title.
    Help = "DEMO.HLP" ' Define Help file.
    Ctxt = 1000 ' Define topic
    ' context.
    ' Display message.
    Response = MsgBox(Msg, Style, Title, Help, Ctxt)
    If Response = vbYes Then ' User chose Yes.
    MyString = "Yes" ' Perform some action.
    Else ' User chose No.
    MyString = "No" ' Perform some action.
    End If
    --------------------
    You could embody this in your existing macro to halt operation until you get the desired reponse.
    Hope this helps
    Astrikor

+ 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