List All Command Bars


Excel

Public Sub BET_ShowCommandBarNames() 
Dim cmdbar As CommandBar
Dim lrownumber As Long

   Workbooks.Add
   lrownumber = 1
   For Each cmdbar In CommandBars
      Range("A" & lrownumber).Value = cmdbar.Name
      Select Case cmdbar.Type
         Case msoBarTypeNormal
               Range("B" & lrownumber).Value = "Toolbar"
               If cmdbar.Name = "Borders" Then cmdbar.Visible = True
         Case msoBarTypeMenuBar
               Range("B" & lrownumber).Value = "Menu Bar"
         Case msoBarTypePopup
               Range("B" & lrownumber).Value = "zShortcut"
      End Select
      lrownumber = lrownumber + 1
   Next cmdbar
   Columns("A:B").Select
   Columns("A:B").EntireColumn.AutoFit
   Range("A1").Select
   Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, _
                  Key2:=Range("A1"), Order2:=xlAscending
End Sub

Word

Public Sub ShowCommandBarNames() 
Dim cmdbar As CommandBar
Dim lrowno As Long
   Documents.Add
   lrowno = 1
   For Each cmdbar In CommandBars
      Selection.TypeText cmdbar.Name
      Selection.TypeText " - "
      Select Case cmdbar.Type
         Case msoBarTypeNormal: Selection.TypeText "Toolbar"
         Case msoBarTypeMenuBar: Selection.TypeText "Menu Bar"
         Case msoBarTypePopup: Selection.TypeText "Shortcut"
      End Select
      lrowno = lrowno + 1
      Selection.TypeParagraph
      Selection.TypeParagraph
   Next cmdbar
End Sub

PowerPoint

Sub ShowCommandBarNames() 
Dim cmdbar As CommandBar
Dim lrowno As Long
Dim stext As String
   lrowno = 1
   stext = ""
   For Each cmdbar In CommandBars
      Select Case cmdbar.Type
         Case msoBarTypeNormal: stext = stext & "Toolbar"
         Case msoBarTypeMenuBar: stext = stext & "Menu Bar"
         Case msoBarTypePopup: stext = stext & "Shortcut"
      End Select
      stext = stext & " - " & cmdbar.Name & " - " & vbCrLf
      lrowno = lrowno + 1
   Next cmdbar
   ActiveWindow.Selection.TextRange.Text = stext
End Sub



© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext