I want to add a control programmatically to a new worksheet:
ActiveSheet.OLEObjects.Add ClassType:="Forms.CommandButton1",Left:=72,Top:=72,Height:=20,Width:=100
Next, I want to add the following code to the button:
Load UserForm1
UserForm1.Show
Can anyone give me some tips on how to accomplish this? I tried the following, without success:
Public Sub Workbook_NewSheet(ByVal Sh As Object)
Load UserForm1
UserForm1.Show
End Sub
Thank you.
ActiveSheet.OLEObjects.Add ClassType:="Forms.CommandButton1",Left:=72,Top:=72,Height:=20,Width:=100
Next, I want to add the following code to the button:
Load UserForm1
UserForm1.Show
Can anyone give me some tips on how to accomplish this? I tried the following, without success:
Public Sub Workbook_NewSheet(ByVal Sh As Object)
Load UserForm1
UserForm1.Show
End Sub
Thank you.