J
John Austin
I need to create event procedures for controls added with Controls.Add.
The following approach was suggested:
Private Sub UserForm_Activate()
Dim Ct As Control, StartLine as long
Set Ct = Me.Controls.Add("Forms.TextBox.1", "txtNew" , True)
With ActiveWorkbook.VBProject.VBComponents("UserForm1").CodeModule
StartLine = .CreateEventProc("Change", Ct.Name) + 1
End With
But I get a runtime error on the .CreateEventProc call - Error 57017 "Event
handler is invalid"
Where have I gone wrong? Are there any other approaches (such as control
arrays in VB6)
Many thanks,
The following approach was suggested:
Private Sub UserForm_Activate()
Dim Ct As Control, StartLine as long
Set Ct = Me.Controls.Add("Forms.TextBox.1", "txtNew" , True)
With ActiveWorkbook.VBProject.VBComponents("UserForm1").CodeModule
StartLine = .CreateEventProc("Change", Ct.Name) + 1
End With
But I get a runtime error on the .CreateEventProc call - Error 57017 "Event
handler is invalid"
Where have I gone wrong? Are there any other approaches (such as control
arrays in VB6)
Many thanks,