To show a OK dialog with a question mark you would type vbOKOnly+vbQuestion in the Buttons+Icon Parameter. The Dialog Title is a string which contains the title text. If this parameter is left blank, then the project name is used as the the Message Box's title
Msgbox "Are you sure?", vbYesNo+VBQuestion, "Front Page"
This shows a message box asking 'Are you sure' with yes and no buttons and a question icon. The Message Box function returns a number which tells you what button was pressed. The following constants are used:
Constant | Button |
vbOK | OK Button |
vbYes | Yes Button |
vbNo | No Button |
vbAbort | Abort Button |
vbRetry | Retry Button |
vbCancel | Cancel Button |
vbIgnore | Ignore Button |
Dim Ans As Integer
Ans = Msgbox("Are you sure?", vbYesNo+vbExclamation , "Front
Page")
If Ans = vbYes Then
Msgbox "You clicked yes"
Else
Msgbox "You clicked no"
End If
This displays a message box asking 'Are you sure?', with yes and no buttons and a exclamation mark. If you click yes, then another message box is displayed saying 'You clicked yes', otherwise it displays a message saying 'You clicked no'.
If you want to include a variables contents in any of the parameters you can use an ampersand (&).
TheText = Text1.Text
Msgbox "The contents of Text1 is" & TheText
---OR---
Msgbox "The contents of Text1 is" &
Text1.Text
Comments