Hello. I have own menu as msoControlPopup with list some values (e.g. bookmarks). Above this list I want to add other the item menu (e.g. "Remove all bookmarks"). And I want to separate it from the list of bookmarks. The list of bookmarks is lower than menu item "Remove all bookmarks". I can to add the separator for menu item "Remove all bookmarks". But it not showed. If I add the separator for list of bookmarks then I get many separators between each menu item. Question: how can I add the separator for my top menu item? Thank you very much. Below - code: Set cbbRmv = cb.Controls.Add(msoControlPopup) With cbbRmv .Caption = "Remove bookmarks" Set cbbAllDelBM = cbbRmv.Controls.Add(msoControlButton) If ActiveDocument.Bookmarks.Count = 0 Then cbbAllDelBM.Enabled = False End If With cbbAllDelBM ' .BeginGroup = True ' HERE NOT SHOWED !!! .Caption = "Remove all bookmarks" .OnAction = "delAllBM" .FaceId = 1985 End With 'remove particular bookmarks If ActiveDocument.Bookmarks.Count > 0 Then For Each bm In ActiveDocument.Bookmarks Set cbbDelBM = cbbRmv.Controls.Add(msoControlButton) With cbbDelBM .Caption = bm.Name .Style = msoButtonCaption .OnAction = "delBM" .BeginGroup = True ' IT SHOW SEPARATOR BETWEEN BOOKMARK !!! End With Next bm End If End With
"avkokin" wrote in message news:07e26afe-8452-488a-ad26-38902304bf02@v13g2000pro.googlegroups.com... > Hello. > I have own menu as msoControlPopup with list some values (e.g. > bookmarks). Above this list I want to add other the item menu (e.g. > "Remove all bookmarks"). And I want to separate it from the list of > bookmarks. The list of bookmarks is lower than menu item "Remove all > bookmarks". I can to add the separator for menu item "Remove all > bookmarks". But it not showed. > If I add the separator for list of bookmarks then I get many > separators between each menu item. > Question: how can I add the separator for my top menu item? To add a separator between the first and second items, set the BeginGroup property of the second item to True. -- Regards Jonathan West - Word MVP www.intelligentdocuments.co.uk Please reply to the newsgroup
Hello Jonathan. Thank's for answer. But if I will add separatot for second item then it will show between each items (bookmarks).
"avkokin" wrote in message news:c7b955f7-5cee-45b1-b602-ad0129c0d42e@m3g2000hsc.googlegroups.com... > Hello Jonathan. Thank's for answer. But if I will add separatot for > second item then it will show between each items (bookmarks). Somewhere towards the end of your macro, add this line cbbRmv.Controls(2).BeginGroup = True That should do the trick. -- Regards Jonathan West - Word MVP www.intelligentdocuments.co.uk Please reply to the newsgroup
Hello Jonathan. There is one trick: First = True If ActiveDocument.Bookmarks.Count > 0 Then For Each bm In ActiveDocument.Bookmarks Set cbbDelBM = cbbRmv.Controls.Add(msoControlButton) With cbbDelBM .Caption = bm.Name .Style = msoButtonCaption .OnAction = "delBM" 'HERE!!! If First Then .BeginGroup = True First = False End If End With Next bm
Yes, that works as well. Glad you've found something that achieves what you want. One small comment. I like to ensure that all my variable names have a prefix indicating the data type (in this case I would use bFirst indicating a Boolean). This serves two purposes: 1. A quick reference to ensure that I don't make an inappropriate assignment to the variable 2. To avoid possible confusion between variable names and properties in the object model. There are several objects that have a First property (e.g. the Paragraphs collection) and if you are using a With-End With structure, it can be all too easy for there to be confusion between "First" and ".First". Prefixing the variable name reduces the risk of this. -- Regards Jonathan West - Word MVP www.intelligentdocuments.co.uk Please reply to the newsgroup "avkokin" wrote in message news:dac3a3a8-5925-4ee0-9356-c06fb975e1d5@l76g2000hse.googlegroups.com... > Hello Jonathan. > There is one trick: > > First = True > > If ActiveDocument.Bookmarks.Count > 0 Then > For Each bm In ActiveDocument.Bookmarks > Set cbbDelBM = cbbRmv.Controls.Add(msoControlButton) > With cbbDelBM > .Caption = bm.Name > .Style = msoButtonCaption > .OnAction = "delBM" > 'HERE!!! > If First Then > .BeginGroup = True > First = False > End If > > End With > Next bm
Jonathan, thank you dor your explain in detail.