![]() |
Cancel Button
I have a Macro with an initial warning in the form of an
OkCancel MsgBox. On 'Ok' I want the macro to continue, and on 'Cancel' I want it to stop entirely. When 'Cancel' is pressed the macro does not stop. What am I missing? Thanks. |
Cancel Button
Try this Matt
Sub test() Dim Answer As String Answer = MsgBox("Hi", vbOKCancel, "Title") If Answer = vbOK Then MsgBox "run the macro" Else MsgBox "By" End If End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Matt" wrote in message ... I have a Macro with an initial warning in the form of an OkCancel MsgBox. On 'Ok' I want the macro to continue, and on 'Cancel' I want it to stop entirely. When 'Cancel' is pressed the macro does not stop. What am I missing? Thanks. |
Cancel Button
Matt,
Is your code like this If ans = vbCancel Then 'quit code End If -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Matt" wrote in message ... I have a Macro with an initial warning in the form of an OkCancel MsgBox. On 'Ok' I want the macro to continue, and on 'Cancel' I want it to stop entirely. When 'Cancel' is pressed the macro does not stop. What am I missing? Thanks. |
Cancel Button
Forgot the first bit
ans = MsgBox ("Hello",vbOKCancel) then the rest. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Bob Phillips" wrote in message ... Matt, Is your code like this If ans = vbCancel Then 'quit code End If -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Matt" wrote in message ... I have a Macro with an initial warning in the form of an OkCancel MsgBox. On 'Ok' I want the macro to continue, and on 'Cancel' I want it to stop entirely. When 'Cancel' is pressed the macro does not stop. What am I missing? Thanks. |
All times are GMT +1. The time now is 06:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com