Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exit Sub Jeff Excel Discussion (Misc queries) 2 March 1st 08 06:21 PM
Run when exit PH NEWS Excel Worksheet Functions 1 July 18th 06 03:53 PM
If a called sub exit, how to the caller exit right away? luvgreen[_4_] Excel Programming 4 February 24th 04 05:06 PM
Exit Sub? Eva Shanley[_2_] Excel Programming 3 December 24th 03 02:15 PM
If no FIND value is found, then a Msgbox to say so and exit sub L. Howard Kittle[_2_] Excel Programming 3 September 23rd 03 08:46 PM


All times are GMT +1. The time now is 08:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"