Macro - msgbox
I have a rather large macro, and I want to give the user a chance to exit the
macro before it runs. I need a msgbox (or a dialogue?) with a warning, and the user will select either OK (to run the defined macro) or cancel (to exit and not run the macro). Can anyone help me? Thanks:) |
Macro - msgbox
traima, here is an example of one with an option if yes no and cancel
Sub Message_box_test() Dim Msg, Title, Response As String Msg = "Put message here" Title = "Put title here" Response = MsgBox(Msg, vbYesNoCancel + vbQuestion, Title) If Response = vbNo Then 'your code if no is clicked here MsgBox "you clicked no" Exit Sub ' Quit the macro End If If Response = vbCancel Then 'your code if Cancel is clicked here MsgBox "You clicked cancelled" Exit Sub ' Quit the macro End If 'your code if Yes is clicked here MsgBox "you clicked yes" End Sub "traima" wrote in message ... I have a rather large macro, and I want to give the user a chance to exit the macro before it runs. I need a msgbox (or a dialogue?) with a warning, and the user will select either OK (to run the defined macro) or cancel (to exit and not run the macro). Can anyone help me? Thanks:) |
All times are GMT +1. The time now is 04:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com