Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Check Point in VBA


Hi!
I would like to have a point in my code that displays a message box
that asks the user if they wish to continue or exit the macro. A simple
"Yes" and "No" button would be ok. This may be a point in the main macro
or a point in one of the subroutines.
1. What would the code look like for stopping the entire macro.
2. What would the code look like to stop the subroutine only.

Thanks for any help or advice!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=540310

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Check Point in VBA

Brian,

The following code will exit the current procedure if the user
clicks Yes.

Dim Res As VbMsgBoxResult
Res = MsgBox("Do you want to continue?", vbYesNo)
If Res = vbNo Then
Exit Sub
End If

The following code will completely terminate VBA if the user
clicks Yes. Note that all public (Global) variables will be reset
to their default values.

Dim Res As VbMsgBoxResult
Res = MsgBox("Do you want to continue?", vbYesNo)
If Res = vbNo Then
End
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Brian Matlack"

wrote in message
news:Brian.Matlack.27jpup_1147187410.7878@excelfor um-nospam.com...

Hi!
I would like to have a point in my code that displays a message
box
that asks the user if they wish to continue or exit the macro.
A simple
"Yes" and "No" button would be ok. This may be a point in the
main macro
or a point in one of the subroutines.
1. What would the code look like for stopping the entire macro.
2. What would the code look like to stop the subroutine only.

Thanks for any help or advice!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile:
http://www.excelforum.com/member.php...fo&userid=3508
View this thread:
http://www.excelforum.com/showthread...hreadid=540310



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Check Point in VBA


Thanks Chip!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=540310

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
Data point on line is not over the point/tick in X axis... TomCat Charts and Charting in Excel 2 September 6th 07 01:36 PM
Increase size of a Forms Check Box (click on to enter check mark) 718Satoshi Excel Discussion (Misc queries) 0 August 17th 07 01:52 AM
X Y Scatter With Point name on each point ? Raj Charts and Charting in Excel 3 July 27th 07 08:47 PM
Check Point in VBA Brian Matlack[_71_] Excel Programming 0 May 9th 06 04:06 PM
I need more general XY point to point plotting than XY scatter in spazminator Charts and Charting in Excel 12 December 19th 05 05:00 PM


All times are GMT +1. The time now is 11:33 PM.

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"