Translates a MsoControlType enumeration into a text description of the control type.
Private Sub DisplayControlDetail()
Dim cb As CommandBar
Dim cbc As CommandBarControl
On Error Resume Next
For Each cb In Application.CommandBars
For Each cbc In cb.Controls
Debug.Print cbc.Caption
Debug.Print TranslateControlType(cbc.Type)
Next
Next
Set cbc = Nothing
End Sub
Function TranslateControlType(vType As MsoControlType) As String
Dim sType As String
Select Case vType
Case Is = MsoControlType.msoControlActiveX
sType = "ActiveX"
Case Is = MsoControlType.msoControlAutoCompleteCombo
sType = "Auto Complete Combo"
Case Is = MsoControlType.msoControlButton
sType = "Button"
Case Is = MsoControlType.msoControlButtonDropdown
sType = "Button Dropdown"
Case Is = MsoControlType.msoControlButtonPopup
sType = "Button Popup"
Case Is = MsoControlType.msoControlComboBox
sType = "Combo Box"
Case Is = MsoControlType.msoControlCustom
sType = "Custom"
Case Is = MsoControlType.msoControlDropdown
sType = "Dropdown"
Case Is = MsoControlType.msoControlEdit
sType = "Edit"
Case Is = MsoControlType.msoControlExpandingGrid
sType = "Expanding Grid"
Case Is = MsoControlType.msoControlGauge
sType = "Gauge"
Case Is = MsoControlType.msoControlGenericDropdown
sType = "Generic Dropdown"
Case Is = MsoControlType.msoControlGraphicCombo
sType = "Graphic Combo"
Case Is = MsoControlType.msoControlGraphicDropdown
sType = "Graphic Dropdown"
Case Is = MsoControlType.msoControlGraphicPopup
sType = "Graphic Popup"
Case Is = MsoControlType.msoControlGrid
sType = "Grid"
Case Is = MsoControlType.msoControlLabel
sType = "Label"
Case Is = MsoControlType.msoControlLabelEx
sType = "Label Ex"
Case Is = MsoControlType.msoControlOCXDropdown
sType = "OCX Dropdown"
Case Is = MsoControlType.msoControlPane
sType = "Pane"
Case Is = MsoControlType.msoControlPopup
sType = "Popup"
Case Is = MsoControlType.msoControlSpinner
sType = "Spinner"
Case Is = MsoControlType.msoControlSplitButtonMRUPopup
sType = "Split Button MRU Popup"
Case Is = MsoControlType.msoControlSplitButtonPopup
sType = "Split Button Popup"
Case Is = MsoControlType.msoControlSplitDropdown
sType = "Split Dropdown"
Case Is = MsoControlType.msoControlSplitExpandingGrid
sType = "Split Expanding Grid"
Case Is = MsoControlType.msoControlWorkPane
sType = "Work Pane"
Case Else
sType = "Unknown control type"
End Select
TranslateControlType = sType
End Function
Related examples in the same category