Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel - add to "Worksheet Menu Bar"

I have found an article that suggests how to add to menu
items to the "Worksheet Menu Bar"

It is for Excel 97 and refers to

CommandBars("Worksheet Menu Bar")

Is this still the accepted method to add/remove a bespoke
item to the main menu? (I am using OXP)

many thanks,

jON

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Excel - add to "Worksheet Menu Bar"

Jon,

Standard approach. Here's an example that adds a new menu before the help
menu

Sub AddMenu()

Dim cMenu1 As CommandBarControl
Dim cbMainMenuBar As CommandBar
Dim iHelpMenu As Integer
Dim cbcCustomMenu As CommandBarControl

On Error Resume Next
Application.CommandBars("Worksheet Menu Bar").Controls("MyMenu").Delete
On Error GoTo 0

Set cbMainMenuBar = Application.CommandBars("Worksheet Menu Bar")

iHelpMenu = cbMainMenuBar.Controls("Help").Index

Set cbcCustomMenu = cbMainMenuBar.Controls.Add(Type:=msoControlPopup,
Befo=iHelpMenu)
cbcCustomMenu.Caption = "MyMenu"

With cbcCustomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "item 1"
.OnAction = "macro1" End With
With cbcCustomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "item 2"
.OnAction = "macro2" End With
With cbcCustomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "item 3"
.OnAction = "macro3"
End With

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"jON R" wrote in message
...
I have found an article that suggests how to add to menu
items to the "Worksheet Menu Bar"

It is for Excel 97 and refers to

CommandBars("Worksheet Menu Bar")

Is this still the accepted method to add/remove a bespoke
item to the main menu? (I am using OXP)

many thanks,

jON



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel - add to "Worksheet Menu Bar"

much obliged Bob.

jON

-----Original Message-----
Jon,

Standard approach. Here's an example that adds a new

menu before the help
menu

Sub AddMenu()

Dim cMenu1 As CommandBarControl
Dim cbMainMenuBar As CommandBar
Dim iHelpMenu As Integer
Dim cbcCustomMenu As CommandBarControl

On Error Resume Next
Application.CommandBars("Worksheet Menu

Bar").Controls("MyMenu").Delete
On Error GoTo 0

Set cbMainMenuBar = Application.CommandBars

("Worksheet Menu Bar")

iHelpMenu = cbMainMenuBar.Controls("Help").Index

Set cbcCustomMenu = cbMainMenuBar.Controls.Add

(Type:=msoControlPopup,
Befo=iHelpMenu)
cbcCustomMenu.Caption = "MyMenu"

With cbcCustomMenu.Controls.Add

(Type:=msoControlButton)
.Caption = "item 1"
.OnAction = "macro1" End With
With cbcCustomMenu.Controls.Add

(Type:=msoControlButton)
.Caption = "item 2"
.OnAction = "macro2" End With
With cbcCustomMenu.Controls.Add

(Type:=msoControlButton)
.Caption = "item 3"
.OnAction = "macro3"
End With

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"jON R" wrote in message
...
I have found an article that suggests how to add to

menu
items to the "Worksheet Menu Bar"

It is for Excel 97 and refers to

CommandBars("Worksheet Menu Bar")

Is this still the accepted method to add/remove a

bespoke
item to the main menu? (I am using OXP)

many thanks,

jON



.

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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Lost "File Menu" - now it's "Edit / View / Insert.." but no "F daves Excel Discussion (Misc queries) 3 April 24th 07 04:52 AM
worksheet menu bar "disappeared" suddenly tikchye_oldLearner57 Excel Discussion (Misc queries) 5 September 18th 06 07:38 PM
VBA to disable "Delete...." on shortcut menu of worksheet tab? Mary Kathryn Excel Discussion (Misc queries) 3 March 3rd 06 05:54 PM
Make "Worksheet Menu Bar" invisible or Delete/hide it's buttons Bob Phillips[_5_] Excel Programming 0 August 11th 03 01:05 PM


All times are GMT +1. The time now is 06:56 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"