Thread: Input boxes
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Input boxes

Apparently my other reply didn't post. Here it is again.

Neither, the InputBox Method nor InputBox Function in and of themselves
provide input options like controls on a UserForm. However, the programmer
can include a text message that the User can then use as a guide line for
making an entry or can select from a proposed list of possible entries to
copy to the entry box. As an example, the InputBox Function:

myVar = InputBox("Enter one of the following: Opt 1, Opt 2, Opt 3",
"OPTIONS")

Whichever option (or even the User's additional option 4) is entered then
becomes the value of myVar and VBA determines the data type from built in
criteria. If you want to restrict the entry to a specific data type, the the
InputBox Method example:

myVar = Application.InputBox("Enter one: Opt 1, Opt 2, Opt 3", "OPTIONS", _
Type:=1)

In the above example, only numeric entries would be accepted (Type:=1).

If I was going to offer a user options to enter values into a spreadsheet
and wanted to limit the options, I would use a user form with preset values
so the User could not get creative on me. But that is just me.

"Oldjay" wrote:

I don't know much about VBA. The help file does not make much sense to me.
Could you give me some code that wil do what i want?

"JLGWhiz" wrote:

I use VBA help files. You can access them by opening the VBA editor, then
click on help and type "InputBox" in the search boxenter. There are two
types of InputBox. The InputBox method allows you to use the Type
designation for control of the data type that the InputBox will accept. The
InputBox function will accept whatever is entered and will assign the data
type based on built in criteria. This is all more fully explained in the
help files.

"Oldjay" wrote:

Where do i go to get info on creating input boxes with three different options?
I need to give the user the option of saving the file to any of three
different locations

oldjay