|
-
Feb 25th, 2005, 05:06 AM
#1
Thread Starter
New Member
MsgBox Help
How do I make my MsgBox return a particular result? I have a vbYesNo msgbox, where i want if "Yes" is clicked then a form will open else if "No" is clicked, the message box closes and no changes are made.
I'm very new to VBA so please excuse my lack of knowledge. Thankingnyou in advance.
-
Feb 25th, 2005, 05:36 AM
#2
Re: MsgBox Help
Type MsgBox in the code window and press f1.
Basically it this :
Msgbox "Message",<buttons> + <icons>,"Title" <<< Displays the message only
Msgbox ("Message",<buttons> + <icons>,"Title") <<< Is a function thus returns the button pressed
So your code would be something like:
Code:
Dim lngRes as long
lngRes = -1
lngRes = Msgbox("The test message",vbyesno+vbexclamation,"Title here")
if lngRes = vbyes then
'---- do yes stuff
else
'---- do no stuff
end if
Help file has the variables / values
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Feb 25th, 2005, 10:56 AM
#3
Lively Member
Re: MsgBox Help
VB Code:
if Msgbox("The test message",vbyesno+vbexclamation,"Title here") = vbYes then
'do yes stuff
else
'do no stuff
endif
is quicker ;-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|