Page 133 - Excel Progamming Weekend Crash Course
P. 133

h540629 ch09.qxd  9/2/03  9:33 AM  Page 108




                108                                                         Saturday Morning








                    Figure 9-1 A message displayed with the MsgBox function
                  The syntax for the MsgBox function is as follows:

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

                   Prompt. A string specifying the message to display.
                   Buttons. A constant specifying the buttons and icons that display in the dialog
                   box, and also which button is the default (you select this by pressing Enter).
                   Permitted values are described in Table 9-1. If this argument is omitted, only an OK
                   button is displayed.
                   Title. A string specifying the dialog box title (displayed in the title bar). Optional.
                   If omitted, the name of the application is used.
                   HelpFile. The name of the help file that provides context-sensitive help for the
                   dialog box (activated by pressing F1). Optional argument.
                   Context. The context identifier for the dialog box’s context-sensitive help.
                   Optional. If the HelpFile argument is provided, context must be provided as well
                   (and vice versa).


               Table 9-1 Constants for the MsgBox Function’s buttons Argument
               Constant (value)           Description
               vbOKCancel (1)             Displays OK and Cancel buttons

               vbAbortRetryIgnore (2)     Displays Abort, Retry, and Ignore buttons
               vbYesNoCancel (3)          Displays Yes, No, and Cancel buttons
               vbYesNo (4)                Displays Yes and No buttons

               vbRetryCancel (5)          Displays Retry and Cancel buttons
               vbCritical (16)            Displays Critical Message icon
               vbQuestion (32)            Displays Warning Query icon

               vbExclamation (48)         Displays Warning Message icon
               vbInformation (64)         Displays Information Message icon
               vbDefaultButton2 (256)     Sets the second button as the default

               vbDefaultButton3 (512)     Sets the third button as the default
   128   129   130   131   132   133   134   135   136   137   138