Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
message box without ok or cancel button | Excel Discussion (Misc queries) | |||
Input Box Cancel Button | Excel Programming | |||
Cancel button in Inputbox method | Excel Programming | |||
input box cancel button | Excel Programming | |||
Button To Cancel Macro | Excel Programming |