Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Wed, 15 Oct 2008 06:57:51 -0700 (PDT),    group: microsoft.public.word.vba.general        back       


How to add into menu (msoControlPopup) the separator?   
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
date: Wed, 15 Oct 2008 06:57:51 -0700 (PDT)   author:   avkokin

Re: How to add into menu (msoControlPopup) the separator?   
"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
date: Wed, 15 Oct 2008 16:20:55 +0100   author:   Jonathan West

Re: How to add into menu (msoControlPopup) the separator?   
Hello Jonathan. Thank's for answer. But if I will add separatot for
second item then it will show between each items (bookmarks).
date: Wed, 15 Oct 2008 09:40:58 -0700 (PDT)   author:   avkokin

Re: How to add into menu (msoControlPopup) the separator?   
"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
date: Wed, 15 Oct 2008 18:04:50 +0100   author:   Jonathan West

Re: How to add into menu (msoControlPopup) the separator?   
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
date: Fri, 17 Oct 2008 02:54:54 -0700 (PDT)   author:   avkokin

Re: How to add into menu (msoControlPopup) the separator?   
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
date: Fri, 17 Oct 2008 11:12:57 +0100   author:   Jonathan West

Re: How to add into menu (msoControlPopup) the separator?   
Jonathan, thank you dor your explain in detail.
date: Fri, 17 Oct 2008 03:42:40 -0700 (PDT)   author:   avkokin

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us