Last active
March 28, 2016 23:01
-
-
Save alistairmcmillan/81ceeb9c11f51795e99d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub ListCommandBarsAndControls() | |
Set ws = ThisWorkbook.Sheets("Sheet1") | |
ws.Rows(1).Cells(1) = "BAR NAME" | |
ws.Rows(1).Cells(2) = "BAR VISIBLE" | |
ws.Rows(1).Cells(3) = "BAR BUILTIN" | |
ws.Rows(1).Cells(4) = "CONTROL ID" | |
ws.Rows(1).Cells(5) = "CONTROL CAPTION" | |
ws.Rows(1).Cells(6) = "CONTROL ENABLED" | |
targetRow = 2 | |
For i = 1 To Application.CommandBars.Count | |
Set sCmdBar = Application.CommandBars(i) | |
ws.Rows(targetRow).Cells(1) = sCmdBar.Name | |
ws.Rows(targetRow).Cells(2) = sCmdBar.Visible | |
ws.Rows(targetRow).Cells(3) = sCmdBar.BuiltIn | |
For j = 1 To Application.CommandBars(i).Controls.Count | |
Set sControl = Application.CommandBars(i).Controls(j) | |
ws.Rows(targetRow).Cells(1) = sCmdBar.Name | |
ws.Rows(targetRow).Cells(2) = sCmdBar.Visible | |
ws.Rows(targetRow).Cells(3) = sCmdBar.BuiltIn | |
ws.Rows(targetRow).Cells(4) = sControl.ID | |
ws.Rows(targetRow).Cells(5) = sControl.Caption | |
ws.Rows(targetRow).Cells(6) = sControl.Enabled | |
targetRow = targetRow + 1 | |
Next j | |
Next i | |
MsgBox "Wabbit!" | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment