#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default menu bars

i've created a menu on my toolbar of type Worksheet Menu Bar. Now,
want to use the same exact menu bars and I understand that I need t
use of type Chart Menu Bar. However, my menu bar has somewhere aroun
15 options and thus you can imagine that there is quite a bit of code
I don't want to have to copy and paste the same exact code to use fo
my chart menu bar. Is it possible to combine the code definition of th
menu bar to work in both types of menu bars? Thanks in advance

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default menu bars

i've created a menu on my toolbar of type Worksheet Menu Bar. Now, I
want to use the same exact menu bars and I understand that I need to
use of type Chart Menu Bar. However, my menu bar has somewhere around
15 options and thus you can imagine that there is quite a bit of code.
I don't want to have to copy and paste the same exact code to use for
my chart menu bar. Is it possible to combine the code definition of the
menu bar to work in both types of menu bars? Thanks in advance.


you can use the index of the Commandbars for both menubars:

Sub MyMenu()
Dim intI As Integer

For intI = 1 To 2
On Error Resume Next
Application.CommandBars(intI).Controls("My Button").Delete
On Error GoTo 0

With Application.CommandBars(intI).Controls.Add(Tempora ry:=True)
.Style = msoButtonCaption
.Caption = "My Button"
.OnAction = "MyMakro"
End With
Next intI
End Sub

Sub MyMakro()
MsgBox "Hello world"
End Sub

--
Regards
Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)

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
ribbon / menu bars Patricia Excel Discussion (Misc queries) 1 August 5th 09 09:39 PM
How to identify active Menu Bars Matz Excel Discussion (Misc queries) 3 August 6th 06 08:21 PM
Delete custom menu bars Martin Walter Setting up and Configuration of Excel 1 June 27th 06 01:15 PM
Disappearing Tool and menu bars J Streger Excel Discussion (Misc queries) 3 March 8th 06 03:42 AM
Lost all my menu bars and tool bars CathyJ Excel Discussion (Misc queries) 3 August 8th 05 12:49 PM


All times are GMT +1. The time now is 06:04 AM.

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"