Skyybot
Well-known Member
- Joined
- Feb 18, 2023
- Messages
- 1,110
- Office Version
- 365
- Platform
- Windows
Novice here. I have a question regarding MsgBox return values. Please keep in mind that the following example will not be used in "Real Life". I only want to satisfy my curiosity. Why does the following code never get to the "Else" line?
Sub curious()
If MsgBox("Hello", vbOKOnly, "Test") = vbOK Then
Debug.Print "Yes was clicked!"
Else
Debug.Print "Close button (red X) was clicked."
End If
End Sub
Sub curious()
If MsgBox("Hello", vbOKOnly, "Test") = vbOK Then
Debug.Print "Yes was clicked!"
Else
Debug.Print "Close button (red X) was clicked."
End If
End Sub