Hello, is there a way to create an active x command button on a worksheet while keeping a userform open?
When I use the following code to add the button on the worksheet, it closes the userform and I have to reload it manually.
Set myb = ActiveSheet.OLEObjects.Add(classtype:="Forms.CommandButton.1", link:=False, displayasicon:=False)
'set button properties
With myb
.Name = "CommandButton3"
.Object.Caption = "Remove " & ActiveSheet.Name
.Object.Font.Bold = True
.Object.Font.Size = 11
.Object.WordWrap = True
.Top = 42.75
.Left = 675
.Width = 72
.Height = 40
.Shadow = True
.Placement = xlMoveAndSize
.PrintObject = False
End With
By the way, the userform is Modeless.
Thanks
Gary