i need a help here, i'm creating a code and one of it's functions will be to create a activeX command button but i need the code to create the button and assign the macro "Sub graft()" to it
So i need the macro to create the activeX button "Commandbutton1" and assign the code
Private Sub CommandButton1_Click()
Call graft()
End sub
i know how to create the button, but i can't find how to assign a code to it the button will be created on a worksheet called "Gráfico" on the ActiveWorkbook
Code of creation and placement of the button
ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False _
, DisplayAsIcon:=False, Left:=1200, Top:=20, _
Width:=100, Height:=30).Select
ActiveSheet.Shapes.Range(Array("CommandButton1")).Select
Selection.Cut
Cells(lline + 26, 1).Select
ActiveSheet.Paste
CutCopyMode = False