#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 43
Default Error Message in VBA

If I wanted to put an error or info message in my VBA code, so that if the
person running the macro wanted to Cancel instead of Okay an input box and no
changes would be made to the excel document, how would I do that?

I'd appreciate any ideas!

Elise
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 65
Default Error Message in VBA



"Elise148" wrote:

If I wanted to put an error or info message in my VBA code, so that if the
person running the macro wanted to Cancel instead of Okay an input box and no
changes would be made to the excel document, how would I do that?

I'd appreciate any ideas!

Elise


Hi Elise, im as well learning VBA and little by little Im building up on my
experience, but in the past I had a similar question as you,
How about putting in your macro a code for a re-set of your inputs when a
command button is clicked withing your sheet?
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 43
Default Error Message in VBA

That's a good idea. The only problem is that I'm sorting data, inserting new
worksheets, and inserting hyperlinks through input boxes.

The first imput box comes up a little ways into the macro. What I am
thinking is that if someone accidentally pushed the macro button, there's no
way to stop the macro and undo the couple steps the macro did before the
input box, besides pushing the "Cancel" button, but that doesn't undo what
the macro did to that point in it...

Any ideas?

"N.F" wrote:



"Elise148" wrote:

If I wanted to put an error or info message in my VBA code, so that if the
person running the macro wanted to Cancel instead of Okay an input box and no
changes would be made to the excel document, how would I do that?

I'd appreciate any ideas!

Elise


Hi Elise, im as well learning VBA and little by little Im building up on my
experience, but in the past I had a similar question as you,
How about putting in your macro a code for a re-set of your inputs when a
command button is clicked withing your sheet?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Error Message in VBA

hi,
just after the input box statement put this...
If MsgBox("do you really want to do this?", vbOKCancel, Confirm) = vbCancel
Then
MsgBox ("Process terminated.")
Exit Sub
End If

regards
FSt1

"Elise148" wrote:

If I wanted to put an error or info message in my VBA code, so that if the
person running the macro wanted to Cancel instead of Okay an input box and no
changes would be made to the excel document, how would I do that?

I'd appreciate any ideas!

Elise

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 43
Default Error Message in VBA

Thanks, I'll give that a try!

"FSt1" wrote:

hi,
just after the input box statement put this...
If MsgBox("do you really want to do this?", vbOKCancel, Confirm) = vbCancel
Then
MsgBox ("Process terminated.")
Exit Sub
End If

regards
FSt1

"Elise148" wrote:

If I wanted to put an error or info message in my VBA code, so that if the
person running the macro wanted to Cancel instead of Okay an input box and no
changes would be made to the excel document, how would I do that?

I'd appreciate any ideas!

Elise



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
#DIV/0! error message Calvina Hayes Excel Worksheet Functions 5 May 6th 07 03:07 PM
VBA Error Message "Compile Error...." Steve Excel Discussion (Misc queries) 3 July 15th 05 09:20 AM
changing the message in an error message The Villages DA Excel Worksheet Functions 2 February 18th 05 05:30 PM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 21st 05 11:39 PM
#num! error message Brenda Excel Worksheet Functions 4 November 19th 04 03:55 AM


All times are GMT +1. The time now is 10:57 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"