-
Fro some reason this code will not work where I have it. it is just a message box with yesno and when yes is no is clicked I want it to exit the sub. Am i missing something:
Dim iAnswer As Integer
MsgBox "Did You Save Your New Changes?", vbYesNo + vbInformation, "Close Inventory History Page"
If iAnswer = vbno Then
Cancel = True
Exit Sub
End If
-
Try this:
Code:
Dim iAnswer As Integer
iAnswer= MsgBox "Did You Save Your New Changes?", vbYesNo + vbInformation, "Close Inventory History Page"
If iAnswer = vbno Then
Cancel = True
Exit Sub
End If
-
Why we need the iAnswer?
If MsgBox("Did You Save Your New Changes?", vbYesNo + vbInformation, "Close Inventory History Page") = vbNo Then
Cancel = True
Exit Sub
End If
Quote:
Try this:
Code:
Dim iAnswer As Integer
iAnswer= MsgBox "Did You Save Your New Changes?", vbYesNo + vbInformation, "Close Inventory History Page"
If iAnswer = vbno Then
Cancel = True
Exit Sub
End If
-
Hai VBAmateur,
You are using msgbox statement it will not return
any values.
what chris is saying is correct.Chris is using a msgbox
function.From that only you can expect a value ,to react
accordingly.
Dim response 'declare a variable to hold the value.
response=msgbox(-------------)
if response=vbyes then
--do something
else
cancel=true
end if
thanks
karun