View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Positioning custom menu

Andy,

Here is some code that might help

Set HelpMenu = CommandBars(1).FindControl(ID:=30010)
Set oMenu = Application.CommandBars("Worksheet Menu
Bar").Controls.Add(Type:= _
msoControlPopup, Befo=HelpMenu.Index, Temporary:=True)

--

HTH

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

"Andy Brown" wrote in message
...
I found some great code from Patrick Molloy for the above, controlled by
Workbook_Activate. Under normal circumstances it would place a new menu
before the Help menu, however I have (and others may also have) custom

items
on the menu bar. I believe the section that controls the positioning is -

With CommandBars("Worksheet Menu Bar")
Set cmd = .Controls.Add(msoControlPopup, _
befo=.Controls.Count, _
temporary:=True)
End With
cmd.Visible = True

, presumably the "befo=.Controls.Count" bit, ie: one before however

many
menu bar items there are.

Is there a way Excel can determine the actual number position of the Help
menu in the bar and place it there minus one?

TIA,
Andy