avkokin said:
Hello. There is some code:
Set oBtn = 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 few
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 = "Toolbar Name:"
Set rgeDoc = ActiveDocument.Range
rgeDoc.Collapse wdCollapseStart
Set colID = New Collection
Set colCap = New Collection
For Each toolbarAll In Application.CommandBars
colID.Add strLabel
colCap.Add toolbarAll.Name
For Each ctrAll In toolbarAll.Controls
colID.Add ctrAll.ID
colCap.Add ctrAll.Caption
Next
Next
For i = 1 To colID.Count
With rgeDoc
.InsertAfter colID(i) & vbTab
.InsertAfter colCap(i) & vbCrLf
If colID(i) = strLabel Then
With .Paragraphs(.Paragraphs.Count).Range
With .Font
.Bold = True
.Size = 14
End With
With .ParagraphFormat
.SpaceBefore = 12
.SpaceAfter = 3
.KeepWithNext = True
End With
End With
End If
End With
Next
rgeDoc.ConvertToTable vbTab
End Sub