PC Review


Reply
Thread Tools Rate Thread

Cancel button on messagebox/inputbox

 
 
Greg
Guest
Posts: n/a
 
      9th Nov 2006
I am just wondering how to stop this from happening.

I have a series of question on a inputbox and when i click the cancel button
it just goes to the next one in line. How do I get excel to go back to the
userform called "main" when either the cancel or the x button is pressed?

Also will this work on a messagebox as well?

Thanks in advance

Greg


 
Reply With Quote
 
 
 
 
NickHK
Guest
Posts: n/a
 
      9th Nov 2006
Greg,
You need to check the return value. e.g.

If MsgBox("Is this [Some Value] correct ?", vbYesNoCancel) = vbCancel Then

With Input boxes, it depends which you are using. According to Help :
1 - VBA.InputBox Function, "If the user clicks Cancel, the function returns
a zero-length string ("")."
2 - Application.InputBox Method, "If you click the Cancel button, InputBox
returns False."

NickHK

"Greg" <(E-Mail Removed)> wrote in message
news:eiua8e$ef1$(E-Mail Removed)...
> I am just wondering how to stop this from happening.
>
> I have a series of question on a inputbox and when i click the cancel

button
> it just goes to the next one in line. How do I get excel to go back to

the
> userform called "main" when either the cancel or the x button is pressed?
>
> Also will this work on a messagebox as well?
>
> Thanks in advance
>
> Greg
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
InputBox Cancel Button A Mad Doberman Microsoft Excel Programming 1 20th Jun 2008 09:49 PM
InputBox - cancel button =?Utf-8?B?R3JlZyBCaWxsaW5nZQ==?= Microsoft Excel Programming 4 11th Oct 2004 06:45 PM
Inputbox and cancel button Uddinj1 Microsoft Excel Programming 5 2nd Mar 2004 11:27 AM
Cancel button in Inputbox method MiRa Microsoft Excel Programming 2 14th Nov 2003 01:04 PM
inputbox - cancel button fedum Microsoft Access VBA Modules 5 15th Sep 2003 08:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:41 AM.