View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Aeronav[_2_] Aeronav[_2_] is offline
external usenet poster
 
Posts: 9
Default InputBox methode

Thanks to both of you.
I use a french version of Excel 2007, but I think that the version is not in
cause
To Dave Peterson
Your Sub works well, but with a strange behaviour :
When run, the inputbox shows the first item of the defaul array : first,
which I overwrite, i.e. with AAA., OK. Immediately the InputBox shows :
second, which I overwrite with BBB, OK. Then : third overwritten by CCC, OK.
Three MsgBoxes appear immediately, successively, presenting AAA, then BBB
and CCC.
So I cannot enter more items than there are in the Default Array. To get
more I can add, for example, 2 empty strings in Dafault : "first", "second",
"third", "", "". Now I can enter 5 items.
I tried also to Redim MyArray(4) but it does not work.
I agree that this is an awful manner to get an Array, but why does Microsoft
offer the Type 64 ?
I can designe simple userforms, so I shall stick to them.

"Aeronav" a écrit dans le message de
...
Hi,
I tried to build a sub to retrieve some values (numbers, boolean, string)
with the InputBox method using Type:=64,
Sub Test()
Dim tableau() as Variant
tableau = Application.inputBox("Essai", Type:=64)
Debug.Print tableau(2)
End Sub
Debuging the project gives no error
Running the Sub, I write in the InputBox "AAA",25,"BBB",64
As soon as I hit OK I get an error, type incompatible.
First : Is my sub correct ?
If it is, How can I write the elements of the Array in the InputBox?
The Excel Help file does not give an example for this type of entry
Thanks