Using Message Boxes

Most of the examples you’ve seen in this book have used the MsgBox function without ever explaining it. Well, the buck stops here. The MsgBox function displays a message in a simple dialog box, waits for the user to click a button, and then returns an integer that indicates which button the user clicked.

The MsgBox function accepts one, two, or three parameters. However, only the first is required. Here are the parameters:

  • Prompt

    This parameter provides the text that the dialog box will display. This must be a String value of at most 1024 characters, depending on the width of the characters used. To create line breaks in the displayed text, include carriage returns, line feeds, or both in the String value. The following expressions ...

Get Faster Smarter Beginning Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.