View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
inquirer inquirer is offline
external usenet poster
 
Posts: 74
Default Control array problem

I haven't used control arrays before and am having trouble with setting
up and using them on a userform.

I have

Private Sub UserForm_Click()

End Sub

Private Sub UserForm_Initialize()
TextBox1(0).Visible = True
For i = 1 To 5
Load TextBox1(i)
TextBox1(i).Text = "A"
TextBox1(i).Visible = True
TextBox1(i).Left = TextBox1(i - 1).Left + 30
Next i

TextBox1(0).SetFocus

End Sub

as the code for userform1 and a module

Sub test()

UserForm1.Show

End Sub


On the userform, I have set the Tabindex for textbox1 to 0.

When I run this, I get a Runtime error 13: Type Mismatch error.

Could someone tell me what is causing this please?

Also, is TextBox1(0).SetFocus ok to set the focus on the first textbox?

Thanks
Chris