How to get access to form's collection in VBA?

CesarF

New Member
Joined
May 16, 2009
Messages
22
Hi,

I created an Access-like forms manager for Excel.
I'm using the control's tag as an identifier for field's handling.
Actually I've 9 xlsm files, with 40+ forms in total and each form with about 20+ controls.

I need to list every control's form/name/tag of all file forms while unloaded, in VBE's immediate window.

This is as far as I can go now, and last line is where I'm stuck:

Rich (BB code):
    For Each cpn In Application.VBE.ActiveVBProject.VBComponents
        If cpn.Type = 3 Then
'           For Each prp In Application.VBE.ActiveVBProject.VBComponents(cpn.Name).Properties
'               Debug.Print "   " & prp.Name
'               Next
           For Each ctl In Application.VBE.ActiveVBProject.VBComponents(cpn.Name).Properties("controls")


I already tried ...Properties("controls")(1).name but it only shows "Count"
and ...Properties("controls")(1).value shows the count of controls, instead the control's first property.
I also tried set frm = Application.VBE.ActiveVBProject.VBComponents(cpn.Name) after the "if", but no luck

I've several files, so I'm looking for a dynamic solution, instead hardcoding every form's name.
I've been googling for hours, but find no
I hope you can help me, thank you in advance.

kr,
César.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
You need the VBComponent.Designer.Controls collection
 
Upvote 0
Solution

Forum statistics

Threads
1,215,095
Messages
6,123,072
Members
449,093
Latest member
ripvw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top