LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default passing commandbars to a procedure

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 procedu

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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing a Function name as a procedure argument [email protected] Excel Programming 9 November 7th 05 02:55 PM
Passing an array or recordset to a stored procedure Paul Robinson Excel Programming 1 December 2nd 04 05:15 AM
Passing Userform as an argument to a procedure Howard Kaikow Excel Programming 12 October 24th 03 03:24 PM
Passing properties to a procedure Matt McQueen[_2_] Excel Programming 1 July 30th 03 04:44 PM
Passing a Password to a VBA Procedure Orlando Magalhães Filho Excel Programming 0 July 9th 03 05:41 AM


All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"