Excel VBA Lesson 2 Message Box

Excel VBA Lesson 1(a) Message Box


Syntax

MsgBox(prompt[,buttons][,title][,helpfile,context])




Message Box type

vbOKOnly Shows only the OK button

vbOKCancel Shows the OK and Cancel buttons

vbAbortRetryIgnore Shows the Abort, Retry, and Ignore buttons

vbYesNo Shows the Yes and No buttons

vbYesNoCancel Shows the Yes, No, and Cancel buttons

vbRetryCancel Shows the Retry and Cancel buttons

vbMsgBoxHelpButton Shows the Help button. For this to work, you need to use the help and context arguments in the MsgBox function

Example:-

Sub MsgBoxYesNo()
MsgBox "Should we stop?", vbYesNo
End Sub

 

About Me

author Click here for Connect FB

Click here for Linkedin