Refer To Controls in a Frame in Worksheet

Viewed 1666

I have the Class Module, and I use it to handle Click event. I use Macro3() to link events with button on the Frame T1 and it works.

I have hundred of Frames (ActiveX Control) with names like T1,T2,T3....

How do I reference the controls in each frame? I tried ActiveSheet.Shapes("T1").Controls("title_pic_tog"). It doesn't work. If we can make this work then I can use a variable to replace Shapes("t1").

Option Explicit
Public WithEvents cBox As MSForms.ToggleButton

Private Sub cBox_Click()
    msgbox("clicked")
    'End If
End Sub

Sub Macro3()
    Set title_pic_tob_Event_Coll = New Collection

    Set title_pic_tob_Event = New titlepictog
    Set title_pic_tob_Event.cBox = ActiveSheet.t1.Controls("title_pic_tog")
    title_pic_tob_Event_Coll.Add title_pic_tob_Event
End sub
1 Answers
Related