View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
astrikor[_9_] astrikor[_9_] is offline
external usenet poster
 
Posts: 1
Default macros -"OK buttons" part way through ?


dyl Wrote:
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


--
astrikor
------------------------------------------------------------------------
astrikor's Profile: http://www.excelforum.com/member.php...o&userid=31465
View this thread: http://www.excelforum.com/showthread...hreadid=518638