I'm trying to find all controls on a MSForm using c# and VBA Extensibility. My problem is that the 'generic' designer object from the VBE (Microsoft.Vbe.Interop) needs to inherit the Controls object from MSForm Interop (Microsoft.Vbe.Interop.Forms)).
You will get better and quicker responses from the experts there.
Best regards, Harry Please remember to mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Thanks Harry. The problem is actually a C# problem and not office.
I have worked out that the problem is down to reflection. In VB.NET, this is automatically catered for, but in c# it is not.
So I need to figure out how to add the Controls collection to Microsoft.Vbe.Interop.VBComponent.Designer at runtime. The controls collection is actualy part of another assembly (msforms) :
foreach (Microsoft.Vbe.Interop.Forms.Control ctrl in Microsoft.Vbe.Interop.VBComponent.Designer.Controls)