Message Box Options

J

James

I have a messae box with yes and no buttons but I cannot
seem to get the code working to have different things
happening when either button is pressed.

Does anyone know the format of the code I need to put in
to acheive this?

Regards

James
 
F

Fredg

James, It would have been helpful to know what you wanted to do if Yes or
No, and the event where you wanted to do this, but here is some generic
code:

Dim intResponse as Integer
intResponse = MsgBox("Do you wish to continue?",vbYesNo)
If intResponse = vbYes then
' Do something here if Yes!!
Else
' Do something here if not Yes!!
End If

Notice I'm using the MsgBox() function, not just a MsgBox.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top