-1

When I write this sub:

Sub IB()
result = Application.InputBox("type a number", , , , , , , 1)
End Sub

The method InputBox has "type" as its last optional parameter, which allows you to restrict the datatype a user can insert. I set it to "1" in this example, restricting the datatype to "number". As far as I understand, by writing it like Application.InputBox I make explicit that InputBox is a method applied to the application. But when I remove the object "application" in the next sub:

Sub IB2()
result = InputBox("type a number", , , , , , ,)
End Sub

InputBox no longer has the paramater "type" as an option . I'd like to know why this happens.

braX
  • 11,506
  • 5
  • 20
  • 33

1 Answers1

0

From the Docs:

The InputBox method differs from the InputBox function in that it allows selective validation of the user's input, and it can be used with Excel objects, error values, and formulas. Notice that Application.InputBox calls the InputBox method; InputBox with no object qualifier calls the InputBox function.

BruceWayne
  • 22,923
  • 15
  • 65
  • 110