ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding Separator Menu Item - Excel 2003 (https://www.excelbanter.com/excel-programming/331305-adding-separator-menu-item-excel-2003-a.html)

Desi

Adding Separator Menu Item - Excel 2003
 
Anyone know how to dynamically add a separator menu item to a custom menu in
Excel 2003?
This code works with the exception that instead of creating a separator menu
item, it simply creates another
menu item with caption "-". Is it possible to get there from here?

TIA

Des
__________________________________________________ _______


Sub test()

Dim ComBar As CommandBar
Dim PopMain As CommandBarPopup
Dim PopAbout As CommandBarButton
Dim PopDivider As CommandBarButton


For Each ComBar In CommandBars
If ComBar.Name = "Worksheet Menu Bar" Then
Set PopMain = ComBar.Controls.Add(msoControlPopup, , ,
(ComBar.Controls.Count - 1), True)
PopMain.Caption = "Custom Menu Name Here"
Exit For
End If
Next

If PopAbout Is Nothing Then
Set PopAbout = PopMain.Controls.Add(msoControlButton, , , , True)
PopAbout.Caption = "&About..."
End If


If PopDivider Is Nothing Then
Set PopDivider = PopMain.Controls.Add(msoControlButton, , , , True)
PopDivider.Caption = "-"
End If

yadda, yadda, yadda...




Robert Bruce[_2_]

Adding Separator Menu Item - Excel 2003
 
Roedd <<Desi wedi ysgrifennu:

Anyone know how to dynamically add a separator menu item to a custom
menu in Excel 2003?


Set the value of the BeginGroup property of the next menuitem to True.


--
Rob

http://www.asta51.dsl.pipex.com/webcam/

This message is copyright Robert Bruce and intended
for distribution only via NNTP.
Dissemination via third party Web forums with the
exception of Google Groups and Microsoft Communities
is strictly prohibited and may result in legal action.



Desi

Adding Separator Menu Item - Excel 2003
 
Too cool for school! Works like a champ Rob, thank you.

BTW, sixteen minute turnaround time on my request ain't bad. Better then any
vendor's customer service dept. I've ever dealt with!

Later!

Des
_________________________

"Robert Bruce" <rob@analytical-dynamicsdotcodotukay wrote in message
...
Roedd <<Desi wedi ysgrifennu:

Set the value of the BeginGroup property of the next menuitem to True.


--
Rob





All times are GMT +1. The time now is 12:14 PM.

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