Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default halting macro

Hi again,
lots of questions from here and thanks for all the good answers! Really
helped.

Another question is how to make a dialogbox where you answer a question
(yes or no answer) were a positive answer would continue to run the
reminding macro while a negative answer would halt the macro right
there.

Is there such an code to resolve this as well?

Kind regards

Jonas

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default halting macro

For example

IF Msgbox("Continue?",vbYesNo,"Pause")=VBNo Then
Exit Sub
End If

Patrick Molloy
Microsoft Excel MVP
-----Original Message-----
Hi again,
lots of questions from here and thanks for all the good

answers! Really
helped.

Another question is how to make a dialogbox where you

answer a question
(yes or no answer) were a positive answer would continue

to run the
reminding macro while a negative answer would halt the

macro right
there.

Is there such an code to resolve this as well?

Kind regards

Jonas

*** Sent via Developersdex http://www.developersdex.com

***
Don't just participate in USENET...get rewarded for it!
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default halting macro

Jonas

If you use the built in msgBox dialog:

Sub test()
Dim iResult As Integer

iResult = MsgBox("Do You want to continue?",
vbYesNo, "Test")
If iResult = vbNo Then
Exit Sub
End If
' Do the rest
End Sub

Note that vbYes, vbNo (and the others) all return an
integer value which you can test for or use the constants
as above

HTH

Leyton


-----Original Message-----
Hi again,
lots of questions from here and thanks for all the good

answers! Really
helped.

Another question is how to make a dialogbox where you

answer a question
(yes or no answer) were a positive answer would continue

to run the
reminding macro while a negative answer would halt the

macro right
there.

Is there such an code to resolve this as well?

Kind regards

Jonas

*** Sent via Developersdex http://www.developersdex.com

***
Don't just participate in USENET...get rewarded for it!
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default halting macro

Here is an example.

sub Test()
dim usrchoice
usrchoice=msgbox("Do You want to continue?",vbyesno)
if usrchoice=vbno then end
msgbox "To be continued..."
end

-----Original Message-----
Hi again,
lots of questions from here and thanks for all the good

answers! Really
helped.

Another question is how to make a dialogbox where you

answer a question
(yes or no answer) were a positive answer would continue

to run the
reminding macro while a negative answer would halt the

macro right
there.

Is there such an code to resolve this as well?

Kind regards

Jonas

*** Sent via Developersdex http://www.developersdex.com

***
Don't just participate in USENET...get rewarded for it!
.

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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 12:41 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 09:40 AM.

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

About Us

"It's about Microsoft Excel"