ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macros -"OK buttons" part way through ? (https://www.excelbanter.com/excel-programming/354993-macros-ok-buttons-part-way-through.html)

dyl

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.


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


Ardus Petus

macros -"OK buttons" part way through ?
 
Try:
Msgbox "Press OK to continue"

HTH
--
AP

"dyl" a écrit dans le
message de ...

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




astrikor[_9_]

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



All times are GMT +1. The time now is 12:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com