Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sub Menu Items

Hi all,

I need a bit of help. Does anyone now how to places items into a su
menu

the menu code is below and i would like to know how to place items i
the project codes menu

==============================================
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("CC
Generator").Delete
On Error GoTo 0
'
' Point to the Worksheet Menu Bar
'
Set cbMainMenuBar = Application.CommandBars("Worksheet Menu Bar")
'
' Set Before Help menu
'
iHelpMenu = cbMainMenuBar.Controls("Help").Index
'
' Add new menu
'
Set cbcCustomMenu = cbMainMenuBar.Controls. _
Add(Type:=msoControlPopup, Befo=iHelpMenu)
'
' Name New Menu
'
cbcCustomMenu.Caption = "CCC Generator"
'
' Add Sub Menus
'
With cbcCustomMenu.Controls.Add(Type:=msoControlPopup)
.Caption = "Project Codes"
.Tag = "Project Codes"
End With

==============================================

Thanks
Pau

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Sub Menu Items

Paul,

Here is an example

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("CCC
Generator").Delete
On Error GoTo 0
'
' Point to the Worksheet Menu Bar
'
Set cbMainMenuBar = Application.CommandBars("Worksheet Menu Bar")
'
' Set Before Help menu
'
iHelpMenu = cbMainMenuBar.Controls("Help").Index
'
' Add new menu
'
Set cbcCustomMenu = cbMainMenuBar.Controls. _
Add(Type:=msoControlPopup, Befo=iHelpMenu, temporary:=True)
'
' Name New Menu
'
cbcCustomMenu.Caption = "CCC Generator"
'
' Add Sub Menus
'
With cbcCustomMenu.Controls.Add(Type:=msoControlPopup)
.Caption = "Project Codes"
.Tag = "Project Codes"
Set CMenu1 = .Controls.Add(Type:=msoControlButton)
With CMenu1
.Caption = "&Sub_Menu1"
.FaceId = 48
.OnAction = "myMacro1"
End With

Set CMenu1 = .Controls.Add(Type:=msoControlButton)
With CMenu1
.Caption = "&Sub_Menu2"
.FaceId = 49
.OnAction = "myMacro2"
End With
End With



--

HTH

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

"pauluk " wrote in message
...
Hi all,

I need a bit of help. Does anyone now how to places items into a sub
menu

the menu code is below and i would like to know how to place items in
the project codes menu

==============================================
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("CCC
Generator").Delete
On Error GoTo 0
'
' Point to the Worksheet Menu Bar
'
Set cbMainMenuBar = Application.CommandBars("Worksheet Menu Bar")
'
' Set Before Help menu
'
iHelpMenu = cbMainMenuBar.Controls("Help").Index
'
' Add new menu
'
Set cbcCustomMenu = cbMainMenuBar.Controls. _
Add(Type:=msoControlPopup, Befo=iHelpMenu)
'
' Name New Menu
'
cbcCustomMenu.Caption = "CCC Generator"
'
' Add Sub Menus
'
With cbcCustomMenu.Controls.Add(Type:=msoControlPopup)
Caption = "Project Codes"
Tag = "Project Codes"
End With

==============================================

Thanks
Paul


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



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
Menu items Pietro Excel Discussion (Misc queries) 2 March 1st 07 10:41 AM
Missing menu items Ken Setting up and Configuration of Excel 3 February 27th 06 07:58 AM
menu items grayed out. WDR Excel Discussion (Misc queries) 1 February 1st 05 07:53 PM
Menu items added with menu item editor in older versions Michael Hoffmann Excel Discussion (Misc queries) 2 January 7th 05 01:40 PM
Disabling menu items in VBE Michael Singmin Excel Programming 1 October 10th 03 01:39 PM


All times are GMT +1. The time now is 12:05 AM.

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"