View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
external usenet poster
 
Posts: 789
Default Exit an entire task ?

Hi
If you have
MsgBox "Click Cancel to abandon this procedure", vbOKCancelOnly, "Help"

you need to replace it with

Response = MsgBox("Click Cancel to abandon this procedure",
vbOKCancelOnly, "Help")

declaring response as a Variant will do. Now in your main sub you have

If Response = vbCancel then Exit sub


regards
Paul

Old Dog wrote:
The problem I have is that I have a msgbox which gives the operator the
opportunity to Exit the task. This procedure was part of the code
behind a Userform. Once they click Cancel the Exit Sub executes with
control reverting back to the original sub routine with the Userform
still present on the screen. What I need is to have the click of the
Cancel to completely close the task.