Here is the documentation on the MsgBox function.
Here's an example of that code. These constants are built into vbscript, so you don't need to declare them. The vbSystemModal
value will cause the message box to be "modal" - as in, it will appear on top of all other windows until it is dismissed.
userInput = MsgBox("Prompt",vbExclamation+vbYesNo+vbSystemModal,"Title")
Select Case userInput
Case vbYes
MsgBox "User pressed yes."
Case vbNo
MsgBox "User pressed no."
End Select
Note that you might want to be careful with an unexpected popup to end users, especially as it relates to which button is default and if the dialog is modal. If a user is typing and they hit spacebar when the box pops up, they might select the default button without reading the message first. You might consider the vbDefaultButton1
or vbDefaultButton2
values to assign a default button.