D
Doug Glancy
I have a procedure that takes a commandbar object as it's argurment:
Sub modify_insert_delete_buttons(cbar As CommandBar, Optional delete As
Boolean = False)
It modifies Excel's existing Insert Rows and Delete Rows buttons on various
Excel commandbars including the Edit menu and the Cells right-click menu.
In the procedure I need to use FindControl which seems to be only available
with CommandbarPopups, not Commandbars. In order to pass the Edit menu to
my routine I've done this in the calling procedure:
Dim cbar As CommandBar
Set cbar = Application.CommandBars("Worksheet Menu
Bar").FindControl(ID:=30003).Controls(1).Parent 'Edit menu
Is there a better way to do this, without calling the Parent of a Control on
the Edit menu? It seems like the following should work, but it gives a type
mismatch error:
Set cbar = Application.CommandBars("Worksheet Menu
Bar").FindControl(ID:=30003)
Again, the way I'm doing it works, I just wonder if there's a better way.
thanks,
Doug
Sub modify_insert_delete_buttons(cbar As CommandBar, Optional delete As
Boolean = False)
It modifies Excel's existing Insert Rows and Delete Rows buttons on various
Excel commandbars including the Edit menu and the Cells right-click menu.
In the procedure I need to use FindControl which seems to be only available
with CommandbarPopups, not Commandbars. In order to pass the Edit menu to
my routine I've done this in the calling procedure:
Dim cbar As CommandBar
Set cbar = Application.CommandBars("Worksheet Menu
Bar").FindControl(ID:=30003).Controls(1).Parent 'Edit menu
Is there a better way to do this, without calling the Parent of a Control on
the Edit menu? It seems like the following should work, but it gives a type
mismatch error:
Set cbar = Application.CommandBars("Worksheet Menu
Bar").FindControl(ID:=30003)
Again, the way I'm doing it works, I just wonder if there's a better way.
thanks,
Doug