Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Drop down menus

Can anyone tell me how to get a drop down menu (say called 'Feeds') on the
Standard toolbar between the Data and Window drop downs and from that menu
items so that I can 'attach' them to macros

Many thanks

James
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Drop down menus

James,

Paste something like this in a code module:

'CreateMyMenu will create the menu
'DeleteMyMenu deletes the menu
'Test is a sub executed in the menu item

Sub CreateMyMenu()
Dim cmdBar As CommandBar
Dim cmdBarMenu As CommandBarControl
Dim cmdBarMenuItem As CommandBarControl

Set cmdBar = Application.CommandBars("Worksheet Menu Bar")
Set cmdBarMenu = cmdBar.Controls.Add(Type:=msoControlPopup,
Befo=cmdBar.Controls("Window").Index)
cmdBarMenu.Caption = "M&yMenu"
cmdBarMenu.Tag = "MINE"
Set cmdBarMenuItem = cmdBarMenu.Controls.Add
With cmdBarMenuItem
.Caption = "&Macro1"
.OnAction = "Test"
.Tag = "MINE"
End With
End Sub

Sub DeleteMyMenu()
Dim c As CommandBarControl
On Error Resume Next
For Each c In Application.CommandBars.FindControls(Tag:="MINE")
c.Delete
Next c
End Sub

Sub test()
MsgBox "Hello, World"
End Sub


--
Hope that helps.

Vergel Adriano


" wrote:

Can anyone tell me how to get a drop down menu (say called 'Feeds') on the
Standard toolbar between the Data and Window drop downs and from that menu
items so that I can 'attach' them to macros

Many thanks

James

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Drop down menus

Spot on Vergel

Thanks for that

James

"Vergel Adriano" wrote:

James,

Paste something like this in a code module:

'CreateMyMenu will create the menu
'DeleteMyMenu deletes the menu
'Test is a sub executed in the menu item

Sub CreateMyMenu()
Dim cmdBar As CommandBar
Dim cmdBarMenu As CommandBarControl
Dim cmdBarMenuItem As CommandBarControl

Set cmdBar = Application.CommandBars("Worksheet Menu Bar")
Set cmdBarMenu = cmdBar.Controls.Add(Type:=msoControlPopup,
Befo=cmdBar.Controls("Window").Index)
cmdBarMenu.Caption = "M&yMenu"
cmdBarMenu.Tag = "MINE"
Set cmdBarMenuItem = cmdBarMenu.Controls.Add
With cmdBarMenuItem
.Caption = "&Macro1"
.OnAction = "Test"
.Tag = "MINE"
End With
End Sub

Sub DeleteMyMenu()
Dim c As CommandBarControl
On Error Resume Next
For Each c In Application.CommandBars.FindControls(Tag:="MINE")
c.Delete
Next c
End Sub

Sub test()
MsgBox "Hello, World"
End Sub


--
Hope that helps.

Vergel Adriano


" wrote:

Can anyone tell me how to get a drop down menu (say called 'Feeds') on the
Standard toolbar between the Data and Window drop downs and from that menu
items so that I can 'attach' them to macros

Many thanks

James

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
Creating Drop-down menus with subset drop-down menus Benjamin Excel Worksheet Functions 4 June 8th 09 11:27 PM
Drop down menus Emerald1170 Excel Worksheet Functions 1 April 30th 09 06:20 PM
Drop Down Menus PAS Excel Discussion (Misc queries) 1 April 6th 09 10:25 PM
Drop-Down Menus aposatsk Excel Discussion (Misc queries) 6 August 21st 06 01:26 PM
Drop down menus Please help Excel Discussion (Misc queries) 1 January 29th 05 07:05 PM


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