Message Box Generator

This Site generates Code for the MsgBox function used in VBScript and VBA. You can hover over most Items to get some Help. Your Choices are not validated.

To decode a message box option number, click here


[X] Button
Default Button
Icon (Aliases in Parenthesis) From the API Documentation: The question-mark message icon is no longer recommended because it does not clearly represent a specific type of message and because the phrasing of a message as a question could apply to any message type. In addition, users can confuse the message symbol question mark with Help information. Therefore, do not use this question mark message symbol in your message boxes. The system continues to support its inclusion only for backward compatibility.
More Options

Marked Options

Options marked with an Asterisk are not mentioned in the MsgBox documentation. They are listed because the underlying API call to MessageBoxA documents them.




MsgBox "Body",0,"Title"

Save this to a file with extension .vbs

Return Value

The return value is an integer representing the pressed button:
  • 1: OK
  • 2: Cancel
  • 3: Abort
  • 4: Retry
  • 5: Ignore
  • 6: Yes
  • 7: No
  • 10: Try Again
  • 11: Continue

Official Documentation

(VBA) MsgBox Function
(API) MessageBox Function
Copyright © 2018 by Kevin Gut 📧 | More services | Generated for