ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add submenu Items (https://www.excelbanter.com/excel-programming/320632-add-submenu-items.html)

Renato[_2_]

Add submenu Items
 
I've been using the following code to enter custom menu
items in a template.

Sub AddMenuItem()
Dim Item As CommandBarControl
Set Item = CommandBars(1).Controls("Budgeting") _
.Controls.Add
Item.Caption = "&January"
Item.BeginGroup = True
End Sub

This works fine. I need to add a submenu item to the
custom menu. so when click january other submenus pop
up. I was look at the help file for VBA, but am unable
to locate this specific topic.
Any help would be greatly appreciated.

Renato

Bob Phillips[_6_]

Add submenu Items
 
Sub AddMenuItem()
Dim Item As CommandBarControl
Set Item = CommandBars(1).Controls("Budgeting") _
.Controls.Add(type:=msoControlPopup)
with Item
.Caption = "&January"
.BeginGroup = True
Set subItem = .Controls.Add(Type:=msoControlButton)
With subItem
.Caption = "Day1"
End With
Set subItem = .Controls.Add(Type:=msoControlButton)
With subItem
.Caption = "Day2"
End With
'etc.
End With
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Renato" wrote in message
...
I've been using the following code to enter custom menu
items in a template.

Sub AddMenuItem()
Dim Item As CommandBarControl
Set Item = CommandBars(1).Controls("Budgeting") _
.Controls.Add
Item.Caption = "&January"
Item.BeginGroup = True
End Sub

This works fine. I need to add a submenu item to the
custom menu. so when click january other submenus pop
up. I was look at the help file for VBA, but am unable
to locate this specific topic.
Any help would be greatly appreciated.

Renato




No Name

Add submenu Items
 
thanks a lot.
I appreciate you help.
Renato
-----Original Message-----
Sub AddMenuItem()
Dim Item As CommandBarControl
Set Item = CommandBars(1).Controls("Budgeting") _
.Controls.Add(type:=msoControlPopup)
with Item
.Caption = "&January"
.BeginGroup = True
Set subItem = .Controls.Add

(Type:=msoControlButton)
With subItem
.Caption = "Day1"
End With
Set subItem = .Controls.Add

(Type:=msoControlButton)
With subItem
.Caption = "Day2"
End With
'etc.
End With
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Renato" wrote in

message
...
I've been using the following code to enter custom menu
items in a template.

Sub AddMenuItem()
Dim Item As CommandBarControl
Set Item = CommandBars(1).Controls("Budgeting") _
.Controls.Add
Item.Caption = "&January"
Item.BeginGroup = True
End Sub

This works fine. I need to add a submenu item to the
custom menu. so when click january other submenus pop
up. I was look at the help file for VBA, but am unable
to locate this specific topic.
Any help would be greatly appreciated.

Renato



.



All times are GMT +1. The time now is 07:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com