Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default menu bar and error 91

hi, i wrote some code which is essentially the following and it gives
error 91 on due to the following line

CommandBars("worksheet menu bar").FindControl(ID:=30002).Copy
bar:=CommandBars("mymenu")

any ideas on how to fix it? thanks again.

this is the full code: 'note be sure not to save since the remove
bar macro is not in this code

Sub Create_MyMenu()
'Hide the Excel worksheet menu bar
Application.CommandBars(1).Enabled = False
'Remove MyMenu if it exists
On Error Resume Next
MenuBars("MyMenu").Delete
On Error GoTo 0
'Create a new blank menu bar called MyMenu
MenuBars.Add "MyMenu"
'Add menu items "Azri1", to the MyMenu bar
MenuBars("MyMenu").Menus.Add Caption:="Azri1"
CommandBars("worksheet menu bar").FindControl(ID:=30002).Copy
bar:=CommandBars("mymenu")
'Add menu items(macros) under the "Azri1" menu item.
With MenuBars("MyMenu").Menus("Azri1").MenuItems
..Add Caption:="&Macro1", OnAction:="Macro1"
..Add Caption:="&Macro2", OnAction:="Macro2"
'etc
End With
'Display the "MyMenu" menu bar
MenuBars("MyMenu").Activate
End Sub
Reply
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
How to use "standard deviation" option in Y error bar menu? Michael Levin Charts and Charting in Excel 1 April 24th 10 01:35 AM
error indicator menu mg_sv_r Excel Discussion (Misc queries) 1 October 5th 07 01:19 PM
Menu bar reset error bretp Excel Programming 0 May 14th 07 02:26 AM
Error when creating menu item on command bar Michael Malinsky Excel Programming 2 October 13th 06 05:31 PM
Error Handling for "my" menu bar dstiefe Excel Discussion (Misc queries) 0 July 27th 05 10:52 PM


All times are GMT +1. The time now is 01:27 PM.

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

About Us

"It's about Microsoft Excel"