Basics of VBA: Message Box
Bottom Line:
Learn how to use different VBA Message Box options.
Note:
Sample Excel with code included below. Please make use of it.
Skill Level: Beginner
Sample File: VBA-MessageBox.xlsm
Syntax:
Prompt − Required parameter, a string, that is displayed as a message in the dialog box.
All the others are optional parameters. Please check the below image for more info (Credits: Microsoft)
Various MessageBox options:
1. with only 'Ok' button:
Code:
2. with 'Ok' and 'Cancel' buttons:
Code:
3. with 'Abort', 'Retry' and 'Ignore' buttons:
Code:
4. with 'Yes', 'No' and 'Cancel' buttons:
Code:
5. with 'Yes' and 'No' buttons:
Code:
Comments
Post a Comment