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!

How do I create a control array? 1

Status
Not open for further replies.

aregan1

Programmer
Feb 12, 2002
46
US
I would like to create a control array of frames on a form. After reading some other threads about similar subjects, it seems that, when adding the frames to my form, I should be prompted with the question "Do you want to create a control array?" However, I don't get prompted with this question.

Would anyone have an idea as to why I don't receive this prompt, or how to get around it?

Thanks for your help...

- Anita
 
Just to clarify ?
If you are drawing the frame then you will NOT be prompted to create a control array. If you create a frame and then copy that frame (NOT draw a new one)you should be prompted the first time you try to paste another in to the form.

 
Thanks, Kevin, for your suggestion, but I tried it with no success. I think John is right in that I'm using VBA, not VB, and it mustn't support control arrays. Thanks for the info, John...

- Anita
 
John is correct. Control arrays are not available in VBA.
 
Bummer! So much for IMPROVING the product. :)
 
Hi,
Here's a way to handle controls as collections. The tactic is to assign the .Tag property with a string designating the control type, ie. CommandButton, OptionButton, etc.
Code:
Sub CntrArray()
'when you set up your frames, assign "Frame" to the .Tag property
    For Each Control In UserForm1.Controls
        Select Case Control.Tag
            Case "Frame"
                MsgBox Control.Name
        End Select
    Next
End Sub
Hope this helps :) Skip,
metzgsk@voughtaircraft.com
 
Yes sorry for misleading you Anita ... I realized immediately following John's post that I had confused VB with VBA.
 
may help, may not...

Dim oCtrl As Control

For Each oCtrl In Controls
Debug.Print oCtrl.Name, TypeName(oCtrl)
Next oCtrl
 
Justin,
I just knew that there must be a way to get that property. Thanx!...

And a STAR! :) Skip,
metzgsk@voughtaircraft.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top