Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MessageBox

Status
Not open for further replies.

ckugo

IS-IT--Management
Jan 6, 2004
165
US
I am trying to create a message box that has a yes/no option and does different things depending on whether or not yes or no is clicked. I can get the message box to have the buttons and looked exactly how I want it to, but I cannot get the buttons to do the proper things. I have read that the yes/no have values of 7 and 6. But I cannot get any farther than that. Any help is greatly appreciated.

Thanks in advance,

Chris
 
check out vbscript section for the answer. or, visit mircosoft's site in msdn for scripting.

you're basically on track.

here's a simple script to demonstrate.

Code:
dim result
result = msgbox("msg",4,"Yes or No")
msgbox result

glenn
 
This thread329-770612 may be of interest for you.
Anyway, feel free to read the FAQs and do a keyword search in this forum for msgbox (Hundreds of hits !)

Hope This Help
PH.
 
I think the bit that you are missing is to do a select statement.

Select Case Result
Case 7
Do this if yes
case 6
Do this if no
Case Else
Do this if something really weird happens
End Select

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Hello ckugo,

Can also use built-in constants vbYes & vbNo then branchout per return integer which is already restricted by the button offered vbYesNo.
Code:
iRet=msgbox("Pick yes or no",vbYesNo,"Testing Msgbox Constants vbYes and vbNo")
If iRet=vbYes then
	msgbox "You've chosen yes."
else
	msgbox "You've chosen no."
end if
regards - tsuji
 
Hello everyone,

This is how I got it to work:

if msgbox("Message.",vbyesno,"Title") = "7" then
wscript.quit
else
blah blah blah...

end if

Thanks to everyone for their help. I will definately take note of the different ways for doing it.

Thanks again,

Chris
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top