View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Helmut Weber[_2_] Helmut Weber[_2_] is offline
external usenet poster
 
Posts: 163
Default Automatically add a textbox to a user form based on user requireme

Hi Brite,

populate the second userform with as many textboxes
as a value from the first userform returns:

Private Sub UserForm_Click()

Dim l As Long
UserForm1.Hide
For l = 1 To Me.TextBox1.Value
Set obj = UserForm2.Controls.Add("Forms.TextBox.1")
If l = 1 Then
obj.Top = 20
Else
obj.Top = l * 20
End If
Next
UserForm2.Show
End Sub


Adjusting the size of the userform2 is another matter,
and controlling where and in what size the textboxes shall appear.

Just to show that it is possible.
There is a lot more to it.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"