Microsoft Office Tutorials and References
In Depth Information
MsgBox strPrompt, vbOKOnly + vbInformation, " Microsoft Office Excel 2003 _
Programming Inside Out"
End If
End Sub
InputBox Method
The InputBox method is very similar to the InputBox function in that both the method and
function display a simple dialog box that allows the user to enter information to be manipu­
lated within your macro. The difference between the two is the InputBox method can
perform selective validation of the user’s input and can be used with other Excel objects, error
values, and formulas. The InputBox function, by contrast, just returns a value you can work
with in a macro.
For more information on creating input boxes, see Chapter 4, “VBA Programming Starter Kit.”
As with the InputBox function, you can specify a prompt to tell the user what type of value
you are looking for, a title to appear within the title bar of the dialog box, a default value,
where on the screen the dialog box should appear, and a link to a Help file. Additionally, you
can specify the type of value the InputBox should accept. The choices are shown in Table 6-1,
along with usage notes. You can add the values together to specify more than one type. For
example, you could add the value for number (1) and the value for text (2) together and use
the sum of 3 to allow the InputBox to accept both numbers and text. When no type is speci­
fied, the default value for text is used.
Search JabSto ::

Custom Search