Hi all,
I want to create a vba program that allow user to input a num(eg 3)
Then the program will add 3 textbox in the form
The problem is how I can get the value of these textbox?
The easiest way to do that is I create couple of textbox in the form, and
hide them
When the user enter 3, I just show the first 3 textbox. Also, I can get the
text from the textbox, becoz the textbox exist.
Is there a better way to do it??
For other language, I can run a string as a line of code. As I know, vba
can't....
Dim i as integer
for i = 1 to num ( from user)
textbox & "i".text = "hihi" <---- I know I cant do it @@
next
Sorry for my bad English. I hope u guys understand what I'm saying
Thanks
Helmut Weber - 07 Mar 2007 15:41 GMT
Hi,
one way:
Private Sub CommandButton1_Click()
Dim l As Long
For l = 1 To 3
Me.Controls("textbox" & CStr(i)).Text = CStr(i)
Next
End Sub
Another way is to google in the groups for
array controls
and my decent name,
on how to create an array of controls at runtime.

Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"