remove a control from a worksheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is the code I used to remove the control, I get runtime error 5 'invalid
procedure call or argument'. Here is the code I used to remove the control:
application.CommandBars("Worksheet Menu Bar").Controls("cmd").Delete

This is the code I used to Add the control:
Set cmd = Application.CommandBars("Worksheet Menu Bar").Controls.Add
With cmd
.BeginGroup = True
.Caption = "myControl"
.BeginGroup = True
.OnAction = "Insert Macro Name Here"
End With
 
Give this a try...

application.CommandBars("Worksheet Menu Bar").Controls("myControl").Delete
 
Back
Top