Mega Code Archive

 
Categories / VisualBasic Script / Application
 

Save list of all predefined commands and their ID numbers in a file

Sub IdList()   On Error Resume Next   If Application.Version >= 10# Then Exit Sub   Dim c As CommandBar, i   Set c = CommandBars.Add   Open ThisWorkbook.Path + "\CommandBar.txt" For Output As #1   For i = 0 To 32     c.Controls.Add Id:=i     If c.Controls(1).Caption <> "" And _        c.Controls(1).Caption <> "[Command not available]" And _        c.Controls(1).Caption <> "custom" Then       Print #1, i, c.Controls(1).Caption     End If     c.Controls(1).Delete   Next i   c.Delete   Close #1 End Sub