Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default How to cancel a macro once started?

I know nothing about VBA except the recorder and able to modify a bit.
I have a macro to erase a form that is activated with a button. I would like
to be able to
have a message to confirm the deletion (Msgbox ) but have the choice to say
no and stop the macro from erasing.
I would appreciate any help please
Thanking you in advance
John

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default How to cancel a macro once started?

Try :
answ = MsgBox("Are you really sure ?", vbYesNo)
If answ = vbNo Then Exit Sub
' delete
Regards.
Daniel

I know nothing about VBA except the recorder and able to modify a bit.
I have a macro to erase a form that is activated with a button. I would like
to be able to
have a message to confirm the deletion (Msgbox ) but have the choice to say
no and stop the macro from erasing.
I would appreciate any help please
Thanking you in advance
John



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default How to cancel a macro once started?

Thank you Daniel
It works great
Have a nice day
John
"Daniel.C" wrote in message
...
Try :
answ = MsgBox("Are you really sure ?", vbYesNo)
If answ = vbNo Then Exit Sub
' delete
Regards.
Daniel

I know nothing about VBA except the recorder and able to modify a bit.
I have a macro to erase a form that is activated with a button. I would
like to be able to
have a message to confirm the deletion (Msgbox ) but have the choice to
say no and stop the macro from erasing.
I would appreciate any help please
Thanking you in advance
John




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default How to cancel a macro once started?

A one liner:

If MsgBox("Do you want to delete?", vbYesNo + vbQuestion, "Confirm Delete")
= vbNo Then Exit Sub


CE



John wrote:
I know nothing about VBA except the recorder and able to modify a bit.
I have a macro to erase a form that is activated with a button. I
would like to be able to
have a message to confirm the deletion (Msgbox ) but have the choice
to say no and stop the macro from erasing.
I would appreciate any help please
Thanking you in advance
John



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default How to cancel a macro once started?

Thanks Charlotte
Works great
Regards
John
"Charlotte E." <@ wrote in message
...
A one liner:

If MsgBox("Do you want to delete?", vbYesNo + vbQuestion, "Confirm
Delete") = vbNo Then Exit Sub


CE



John wrote:
I know nothing about VBA except the recorder and able to modify a bit.
I have a macro to erase a form that is activated with a button. I
would like to be able to
have a message to confirm the deletion (Msgbox ) but have the choice
to say no and stop the macro from erasing.
I would appreciate any help please
Thanking you in advance
John






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default How to cancel a macro once started?

Daniel;
Thanks very much for the code. It is working wonderfully!!!!!!

Kind regards.
Maperalia

"Daniel.C" wrote:

Try :
answ = MsgBox("Are you really sure ?", vbYesNo)
If answ = vbNo Then Exit Sub
' delete
Regards.
Daniel

I know nothing about VBA except the recorder and able to modify a bit.
I have a macro to erase a form that is activated with a button. I would like
to be able to
have a message to confirm the deletion (Msgbox ) but have the choice to say
no and stop the macro from erasing.
I would appreciate any help please
Thanking you in advance
John




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
How to get Started with macro? Sherees Excel Discussion (Misc queries) 2 December 12th 09 01:10 AM
How to return to worksheet where macro started? Bob Arnett Excel Programming 3 May 4th 08 08:51 PM
cancel the "Getting Started" Dialogue Box when I open XL/Word jazzy1 Setting up and Configuration of Excel 1 May 2nd 08 12:53 AM
Cancel button to cancel the whole macro excelnut1954 Excel Programming 3 January 17th 06 08:27 PM
Cancel Macro is user selects 'cancel' at save menu Mark Excel Programming 1 April 6th 05 05:45 PM


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

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"