generate sub dynamically
Christian,
Assuming a control toolbox combobox, here is an example of adding its click
event
With
ThisWorkbook.VBProject.VBComponents(Worksheets("Sh eet2").CodeName).CodeModul
e
.InsertLines .CreateEventProc("Click", "ComboBox1") + 1, _
vbTab & "If Range(""A1"").Value 0 Then " & vbCrLf & _
vbTab & vbTab & "Msgbox ""Hi""" & vbCrLf & _
vbTab & "End If"
End With
which will add this code
Private Sub ComboBox1_Click()
If Range("A1").Value 0 Then
MsgBox "Hi"
End If
End Sub
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Christian Galbavy" wrote in message
...
Hello!
I generate comboboxes dynamically in my code. Now I also want to
manipulate
the approbriate Change-functions of these elements. Is this possible and
how?
For example, I insert a new comobox and name it "my_box".
Now I want to manipulate the function "my_box_Change" by my code.
Thanks for your answers!
Regards
Christian Galbavy
|