Group: microsoft.public.word.vba.general
From: avkokin
Date: Thursday, March 06, 2008 2:05 AM
Subject: Re: How can I get list of commands and relevant the commands ID (ident

On 5 =D0=BC=D0=B0=D1=80, 20:01, avkokin wrote:
> On 5 =C3=8D=C3=81=C3=92, 18:10, Jean-Guy Marcil
>
>
>
> wrote:
> > "avkokin" wrote:
> > > Hello. There is some code:
> > > Set oBtn =3D oPopUp.Controls.Add(msoControlButton, 1589)
> > > Question: how can I get list of commands and relevant the commands ID
> > > (identification numbers)?
> > > Thank you.
>
> > Run this code (Depending on your system it can take a few seconds or a f=
ew
> > minutes...). Make sure you have nothing but a blank document active.
>
> > Option Explicit
>
> > Sub GetAllControlID()
>
> > Dim toolbarAll As CommandBar
> > Dim ctrAll As CommandBarControl
> > Dim colID As Collection
> > Dim colCap As Collection
> > Dim i As Long
> > Dim rgeDoc As Range
>
> > Const strLabel As String =3D "Toolbar Name:"
> > Set rgeDoc =3D ActiveDocument.Range
> > rgeDoc.Collapse wdCollapseStart
>
> > Set colID =3D New Collection
> > Set colCap =3D New Collection
>
> > For Each toolbarAll In Application.CommandBars
> > =C5=A1 =C5=A1 colID.Add strLabel
> > =C5=A1 =C5=A1 colCap.Add toolbarAll.Name
> > =C5=A1 =C5=A1 For Each ctrAll In toolbarAll.Controls
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 colID.Add ctrAll.ID
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 colCap.Add ctrAll.Caption
> > =C5=A1 =C5=A1 Next
> > Next
>
> > For i =3D 1 To colID.Count
> > =C5=A1 =C5=A1 With rgeDoc
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 .InsertAfter colID(i) & vbTab
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 .InsertAfter colCap(i) & vbCrLf
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 If colID(i) =3D strLabel Then
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 With .Paragraphs(.Paragraphs.C=
ount).Range
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 With .Font
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 .B=
old =3D True
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 .S=
ize =3D 14
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 End With
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 With .ParagraphF=
ormat
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 .S=
paceBefore =3D 12
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 .S=
paceAfter =3D 3
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 .K=
eepWithNext =3D True
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 End With
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 =C5=A1 End With
> > =C5=A1 =C5=A1 =C5=A1 =C5=A1 End If
> > =C5=A1 =C5=A1 End With
> > Next
>
> > rgeDoc.ConvertToTable vbTab
>
> > End Sub
>
> Thanks, Jean-Guy Marcil!

Hello again.
How can I get list of commands (and ID) from the ribbon and commands
from groups (Word 2007)? These commands miss into the list of commands
for Toolbars, e.g. Special Paste (or PasteSpecialDialog). Thank you
very much!

Safety Articles | Usenet Groups | Usenet News | Bluegrass