What value does "cancel" have in a msgbox??


Posted by Mike on August 09, 2000 5:45 AM

here is the code:
sub mike()
varanswer= msgbox(".....","....", vb...)
if varanswer = CANCLE exit sub
....
...
...
end sub

what value is used for cancle.?????



Posted by Michael Liu on August 09, 0100 7:51 AM

This routine seems to suggest the value is 2.

Sub CancelTest()
a = MsgBox("test", vbOKCancel, "Title")
If a = 2 Then MsgBox "Cancel selected"
End Sub

It also corresponds to the internal variable vbCancel

Sub CancelTest2()
a = MsgBox("test", vbOKCancel, "Title")
If a = vbCancel Then MsgBox "Cancel selected"
End Sub