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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MsgBox Question

Status
Not open for further replies.

FranS37

Programmer
Jun 6, 2002
59
US
I use this message box to prompt the user:

MsgBox "Save this PO", vbYesNo, "Purchase Order"
If vbYesNo = No Then.....

The value of vbYesNo, regardless of whether I click Yes or No, is 4!

Can anybody help?

Thanks, Fran

 
Fran,

You need to use MsgBox in a function call, thus:

If MsgBox ("Save this PO", vbYesNo, "Purchase Order") = vbNo Then
' stick some code here
End If

If you need to check the result later on, you can assign the result of the MsgBox function to an integer variable and refer to it later on. There are many variables in addition to vbNo, representing different buttons, each of which has an integer value.

John
 
Try this
If (MsgBox "Save this PO?",vbYesNo)=vbNo Then



Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top