InputBox

G

GeorgeJ

I am using John Walkenbach's excellent EXCEL 2006 - POWER PROGRAMMING WITH VBA

On page there is the following code

Set UserRange = Application.InputBox( _
Promopt:=Prompt, _
Title:=Title, _
Default:=ActiveCell.Address, _
Type:=8)


I have verified that this code complies and runs as indicated in the book.

On the previous page the author advises the reader not to confuse Excel's
InputBox function with VBA's InputBox function.

On page 326 the author writes "specifying a Type argument of 8 for the
InputBox method is the key to this procedure"

I have been unsuccessful in trying to find out anything about Excel's
InputBox procedure. I have tried jumping around in Excel's help file and
haven't been able to see any mention of this procedure. I would sure
appreciate it if someone could show me, with some specificity, how to find
out about this procedure.
 
B

Bob Umlas

Function
x=Inputbox("Age?")

Method:
x=Application.Inputbox("Age?",Type:=1)

There is no Type argument in the Function vesion.
 
G

GeorgeJ

--
-Thank you Bob. So, as I understand it, there is both a function and a
method version of InputBox in Excel. How might I find out more about the
method version? Specifically, what the Type parameter means. If someone
could walk me through exactly how one finds out about the details of a method
such as InputBox in Excel 2007 I would be most appreciative.
 
G

Gord Dibben

From VBA help.................

Type Optional Variant. Specifies the return data type. If this argument is
omitted, the dialog box returns text. Can be one or a sum of the following
values.

Value Meaning
0 A formula
1 A number
2 Text (a string)
4 A logical value (True or False)
8 A cell reference, as a Range object
16 An error value, such as #N/A
64 An array of values


Gord Dibben MS Excel MVP
 
G

GeorgeJ

--Thank you Gord. That was extremely helpful. I am very impressed and
grateful for the prompt help available on this forum.

I will repeat my more general questions

1) what exactly does Walkenback mean when he writes (pg. 324) " Do not
confuse Excel's InputBox method with VBA's InputBox function. Although these
two items have the same name they are not the same" ? Can someone show a
short bit of VBA code which uses both the Excel Inputbox method and VBA
InputBox Function ?

2) Is there any way, other than posting a question on this forum, that I
could have discovered the information Gord presented on his post? This forum
is great but I am trying to find out if there is any way to find information
on the details of Excel methods such as InputBox without going to a forum.
Perhaps I'm not using Excel's help system efficiently, but I drew a blank
when I tried to use HELP to find InputBox. If someone could specify the
exact trail I should have followed it would be very helpful to me.

-regards
 
G

Gord Dibben

I found the material I posted in VBA help under "InputBox".

The top two items returned were "InputBox Method" as it applies to Application
and "InputBox Function(VBA)


Gord
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top