![]() |
VB msgbox exit
[font=courier new]I've got a msgbox that asks a question, that questio
being "Do you wish to continue?" and two VB button, "yes" & "No". I they click "yes" I want the macro to continue, if on the other han they click "no" I want the .xls to close without saving. Can this be done and if so how?[/FONT -- Message posted from http://www.ExcelForum.com |
VB msgbox exit
Try something like
Dim Result As Long Result = MsgBox("Do you want to continue", vbYesNo) If Result = vbNo Then ThisWorkbook.Close savechanges:=False Exit Sub End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Fraggs " wrote in message ... I've got a msgbox that asks a question, that question being "Do you wish to continue?" and two VB button, "yes" & "No". If they click "yes" I want the macro to continue, if on the other hand they click "no" I want the .xls to close without saving. Can this be done and if so how? --- Message posted from http://www.ExcelForum.com/ |
VB msgbox exit
If MsgBox("Do you want to continue", vbYesNo) = vbNo Then ActiveWorkbook.Close SaveChanges:=False Exit Sub End If -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Fraggs " wrote in message ... I've got a msgbox that asks a question, that question being "Do you wish to continue?" and two VB button, "yes" & "No". If they click "yes" I want the macro to continue, if on the other hand they click "no" I want the .xls to close without saving. Can this be done and if so how? --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 06:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com