
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
in my Autocad VBA code, I'm creating a series of dynamic buttons. But by simplifying the case, let's see a simple case :
Dim myCustomControl As Control
Set myCustomControl = UserForm1.Controls.Add("Forms.CommandButton.1", "MyButton", True)
With myCustomControl
.Caption = "myTextButton"
.Left = 0
.Width = 50
.top = 0
End With
I need to associate a macro to this button. I tried to define the sub:
Private Sub MyButton_Click()
msgBox ("hello!")
End Sub
But when I click on the button the sub is not called 🤔 .
1) Is there something different to be done?
2) Can I give a generic name to the associated macro (not "MyButton_Click()" by also passing generic parameters MyMacro(par1 par2)?
Thank you,
Giuseppe
Solved! Go to Solution.