Page 94 - Microsoft Office Excel 2003 Programming Inside Out
P. 94

Microsoft Office Excel 2003 Programming Inside Out


                             Note  While it’s easier to use the intrinsic constants for a carriage return and a line feed,
                             you might see (Chr$(13)) for a carriage return, (Chr$(10)) for a line feed, and (Chr$(13) &
                             Chr$(10)) for both.

                               ●	 buttons  Optional numerical argument used to specify the buttons and the icon that
                                  is to be displayed within the message box. By adding the value of the selected options
                                  together, you can specify not only which buttons and icon to display, but also which
                                  button is the default button and the modality of the message box. You can use the
                                  Visual Basic intrinsic constants to specify options. See Table 4-9 for a complete list of
                                  options available. The default button is selected if the user presses the Enter key. If
                                  buttons is not given, the default value of 0 is used.
                               ●	 title  Optional string argument used to specify the text to be displayed within the
                                  message boxes title bar. If omitted, “Microsoft Office Excel” is displayed.
                               ●	 helpfile  Optional string argument used to specify the help file used to provide con-
                                  text-sensitive help. If helpfile is specified, context must also be specified.
                               ●	 context  Optional numerical argument that is the Help context number assigned to
                                  the appropriate Help topic. If context is provided, helpfile must also be provided.
                             The MsgBox function returns an integer value that indicates which button was clicked by the
                             user. These values are listed in Table 4-10.
                             Table 4-9.  Button Options for Message Boxes
                             Intrinsic Constant    Value       Description
                             Buttons
                             vbOkOnly              0           Displays an OK button only.
                             vbOkCancel            1           Displays an OK and a Cancel button.
             Chapter 4
                             vbAbortRetryIgnore    2           Displays three buttons labeled Abort, Retry, and
                                                               Ignore.
                             vbYesNoCancel         3           Displays three buttons labeled Yes, No, and
                                                               Cancel.
                             vbYesNo               4           Displays buttons labeled Yes and No.
                             vbRetryCancel         5           Displays buttons labeled Retry and Cancel.
                             Icons
                             vbCritical            16          Displays a solid red circle enclosing a white X.
                             vbQuestion            32          Displays a cartoon balloon enclosing a question
                                                               mark.
                             vbExclamation         48          Displays a yellow triangle enclosing an
                                                               exclamation point.
                             vbInformation         64          Displays a cartoon balloon enclosing a
                                                               lowercase letter i.


                68
             Part 2:  Visual Basic for Applications
   89   90   91   92   93   94   95   96   97   98   99