Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Public Array of Type 'Control' in userforms

Status
Not open for further replies.

yk01

Programmer
Dec 18, 2001
2
CA
I've generated a userform with textboxes inserted in runtime.
Following Syntax:
Public MyTextBoxes(20) As Control
...
Set UF1 = ThisWorkbook.VBProject.VBComponents.Add(vbext_ct_MSForm)
...
Set MyTextBoxes(TBCount) = UF1.Designer.Controls.Add("Forms.TextBox.1")

After (means really only in the command lines after) calling with following syntax the Userform, I am not able to access the 'Control' - variables any more (for example by command: Cells(1,1).value = MyTextBoxes(0).text):

VBA.UserForms.Add("LabelForm").Show
I get an 'catastrophic error' message.
What is the reason? Can I solve the problem easily?

It is just a real short (hopefully inspiring) description of my problem, but I hope there is somebody out there who can give me some advice or help.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top