Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub ListXLPopups()
Dim cbCtl As CommandBarControl
Dim cbBar As CommandBar
Dim i As Integer
On Error Resume Next
Application.ScreenUpdating = False
Cells(1, 1).Value = "CommandBar"
Cells(1, 2).Value = "Control"
Cells(1, 3).Value = "FaceID"
Cells(1, 4).Value = "ID"
i = 2
For Each cbBar In CommandBars
Application.StatusBar = "Processing Bar " & cbBar.Name
If cbBar.Type = msoBarTypePopup Then
Cells(i, 1).Value = cbBar.Name
i = i + 1
For Each cbCtl In cbBar.Controls
Cells(i, 2).Value = cbCtl.Caption
cbCtl.CopyFace
If Err.Number = 0 Then
ActiveSheet.Paste Cells(i, 3)
Cells(i, 3).Value = cbCtl.FaceId
End If
Cells(i, 4).Value = cbCtl.ID
Err.Clear
i = i + 1
Next cbCtl
End If
Next cbBar
Range("A:B").EntireColumn.AutoFit
Application.StatusBar = False
End Sub
Sub ListWRDPopups()
'this is my attempt to recreate the above procedure for Word
Dim cbCtl As CommandBarControl
Dim cbBar As CommandBar
Dim i As Integer
Dim wdApp As New Word.Application
On Error Resume Next
Application.ScreenUpdating = False
Cells(1, 1).Value = "CommandBar"
Cells(1, 2).Value = "Control"
Cells(1, 3).Value = "FaceID"
Cells(1, 4).Value = "ID"
i = 2
For Each cbBar In wdApp.CommandBars
Application.StatusBar = "Processing Bar " & cbBar.Name
'Add the following condition if required
'If cbBar.Type = msoBarTypePopup Then
Cells(i, 1).Value = cbBar.Name
i = i + 1
For Each cbCtl In cbBar.Controls
Cells(i, 2).Value = cbCtl.Caption
cbCtl.CopyFace
If Err.Number = 0 Then
ActiveSheet.Paste Cells(i, 3)
Cells(i, 3).Value = cbCtl.FaceId
End If
Cells(i, 4).Value = cbCtl.ID
Err.Clear
i = i + 1
Next cbCtl
'End If
Next cbBar
wdApp.Quit
Range("A:B").EntireColumn.AutoFit
Application.StatusBar = False
End Sub