VBA‎ > ‎

VBA code for a yes/no message box

This code presents the user with 2 buttons:   a Yes button and a No button.
 
Dim Answer As String
Dim MyNote As String
MyNote = "Scan another page?"
Answer = MsgBox(MyNote, vbQuestion + vbYesNo, "???")
If Answer = vbNo Then
    Do something...
Else
    Do something
End If
 
This code does the same thing but presents the user with 2 buttons:   a Yes button and a cancel button.
 
Dim Answer As String
Dim MyNote As String
MyNote = "Scan another page?"
Answer = MsgBox(MyNote, vbQuestion + vbOKCancel, "???")
If Answer = vbCancel Then
    Do something...
Else
    Do something
End If
 
 
 
 
 
 
 
 
 
 
Comments