• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

12. Built-in Functions and Statements > 12.1. The MsgBox Function

The MsgBox Function

We have been using the MsgBox function unofficially for some time now. Let us introduce it officially. The MsgBox function is used to display a message and wait for the user to respond by pushing a button. The most commonly used syntax is:

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

(This is not the function’s complete syntax. There are some additional optional parameters related to help contexts that you can look up in the help documentation.)

prompt is a String parameter containing the message to be displayed in the dialog box. Note that a multiline message can be created by interspersing the vbCrLf constant within the message.

buttons is a Long parameter giving the sum of values that specify various properties of the message box. These properties are the number and type of buttons to display, the icon style to use, the identity of the default button, and the modality of the message box. (A system modal dialog box remains on top of all currently open windows and captures the input focus systemwide, whereas an application modal dialog box remains on top of the application’s windows only and captures the application’s focus.) The various values of buttons that we can sum are shown in Table 12-3. (They are officially defined in the VbMsgBoxStyle enum.)


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint