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

40                                         EXCEL: NUMERICAL METHODS



               respectively.  For information about helpfile and context, refer to Microsoft Excel
               Visual Basic Reference.
                   If the user presses the OK button or the RETURN key, the InputBox function
               returns as a value whatever is in the text box.  If the Cancel button is pressed, the
               function returns a  null  string.  The following  example produces the  input box
               shown in Figure 2- 15.
                   ReturnValu = InputBox("Enter validation code number", -
                   "Validation of this copy of SOLVER.STATS")















                                     Figure 2-15.  An  InputBox display.

                   The syntax of the InputBox method is
                   Object.lnputBox(prompt_text, title-text,  default, x-position,  y-position,
                   helpfile, context, type-num)
                   The differences between  the  InputBox function  and the  InputBox method
               are  the  following:  (i)  default  can  be  any  data  type  and  (ii)  the  additional
               argument type-num  specifies the data type of the return  value.  The values  of
               type-num  and the corresponding data types are listed  in  Table 2-9.  Values of
               type-num  can be added together.  For example, to specify an  input dialog box
               that would  accept number or string values as input, use the value  1 + 2 = 3  for
               type-num.

                                  Table 2-9.  InputBox Data Type Values
                                type-n um         Data Type
                                   0              Formula
                                   1              Number
                                   2              String
                                   4              Logical
                                   8              Reference (as a Range object)
                                   16             Error value
                                   64             Array
   58   59   60   61   62   63   64   65   66   67   68