ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Exit an entire task ? (https://www.excelbanter.com/excel-programming/346531-exit-entire-task.html)

Old Dog

Exit an entire task ?
 
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.


[email protected]

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.




All times are GMT +1. The time now is 07:34 PM.

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