AnsweredAssumed Answered


Question asked by Willie Roelofs on Jun 4, 2015
Latest reply on Jun 9, 2015 by Deepak Gupta



I'm trying to run the following using the VBA that solidworks provides.


Private WithEvents m_oTextBox as TextBox
Public Property Set TextBox(ByVal oTextBox as TextBox)
   Set m_oTextBox = oTextBox
End Property
Private Sub m_oTextBox_Change()
   ' Do something
End Sub
Private m_oCollectionOfEventHandlers As Collection
Private Sub UserForm_Initialise()
    Set m_oCollectionOfEventHandlers = New Collection
    Dim oControl As Control
    For Each oControl In Me.Controls
        If TypeName(oControl) = "TextBox" Then
            Dim oEventHandler As TextBoxEventHandler
            Set oEventHandler = New TextBoxEventHandler
            Set oEventHandler.TextBox = oControl
             m_oCollectionOfEventHandlers.Add oEventHandler
        End If
    Next oControl
End Sub