Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Easy count of custom menuitems that perform an action (macro)
In case anyone else would like to find out how many custom menuitems
they have made... Sub CountAllCustomMacrosInExcel() Dim cb As Office.CommandBar Dim CBC As Office.CommandBarControl Dim count As Long For Each cb In Application.CommandBars For Each CBC In cb.Controls RecursiveCountMacroButtons CBC, count Next Next Debug.Print count End Sub Public Function RecursiveCountMacroButtons(CBC As Office.CommandBarControl, ByRef count As Long) Dim cbp As Office.CommandBarPopup Dim cbb As Office.CommandBarButton Dim ncbc As Office.CommandBarControl If TypeOf CBC Is Office.CommandBarPopup Then Set cbp = CBC For Each ncbc In cbp.Controls RecursiveCountMacroButtons ncbc, count Next ElseIf TypeOf CBC Is Office.CommandBarButton Then Set cbb = CBC If Not cbb.BuiltIn Then If Len(cbb.OnAction) Then count = count + 1 'Cells(count + 2, 1) = cbb.OnAction End If End If End If End Function |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to perform action based on value in cell | Excel Programming | |||
Need to perform action on range | Excel Programming | |||
Add menuitems to custom created menu | Excel Programming | |||
How to 'Click and then perform action' | Excel Programming | |||
How to perform action in all worksheets | Excel Programming |