Search notes:

VB Editor Object Model: Iterate over controls of the VB Editor

The following simple PowerShell script iterates over the CommandBars collection of the VBE (root) object of the VB Editor Object Model.
When executed, an Excel instance must be running.
The function get-activeObject is defined in the COM PowerShell module.
$xls = get-activeObject excel.application
 
$cmdBars = $xls.VBE.CommandBars
 
foreach ($cmdBar in $cmdBars){
      $cmdBar.name
      foreach ($control in $cmdBar.controls) {
            "  - $($control.caption) ($($control.id))";
       }
}

Index