Page 61 - Excel for Scientists and Engineers: Numerical Methods
P. 61

38                                         EXCEL: NUMERICAL METHODS


               icon  and  the  number  and  type  of  response  buttons;  it  also determines  which
               button  is the default button.  The possible values are listed  in Table 2-8.  The
               values 0-5  specify the number and type of buttons, values 16-64  specify the type
               of  message  icon  and  values  0,  256,  512  specify  which  button  is  the  default
               button.  You  add  together  one  number  from  each  group to  form  a value  for
               buttons.  For example, to specify a dialog box with a Warning Query icon, with
               Yes, No and Cancel buttons, and with the No button as default, the values 32 + 3
               + 256 = 291.
                          Table 2-8.  Values for the buttons Parameter of MsgBox
                   buttons  Equivalent
                   Value    Constant           Description
                     0      vbOKOnly           Display OK button only.
                     1      vbOKCancel         Display OK and Cancel buttons.
                     2      vbAbortRetrylgnore  Display Abort, Retry and Ignore buttons.
                     3      vbYesNoCancel      Display Yes, No and Cancel buttons.
                     4      v bY es N o        Display Yes and No buttons.
                     5      v b Ret ry Cancel   Display Retry and Cancel buttons.

                     0                         No icon.
                     16     vbCritical         Display Critical Message icon.
                     32     vbQuestion         Display Warning Query icon.
                     48     vbExclamation      Display Warning Message icon.
                     64     vblnformation      Display Information Message icon.

                     0      vbDefaultButton1   First button is default.
                     256    vbDefaultButton2   Second button is default.
                     512    vbDefaultButton3   Third button is default.

                   For example, the VBA expression,
                   MsgBox "You entered " & incr & "_" & Chr( 13) & Chr( 13) & -

                   "That value is too large." & Chr( 13) & Chr( 13) & "Please try again.", 48
               where the VBA variable incr has the value 50, produces the message box shown
               in Figure 2-14.
   56   57   58   59   60   61   62   63   64   65   66