Counting Custom Toolbars

The following function returns the number of custom toolbars. It loops through the CommandBars collection and increments a counter if the command bar represented by cb is a toolbar and if its BuiltIn property is False.

Function CustomToolbars() Dim cb As CommandBar Dim Count As Integer Count = 0

For Each cb In CommandBars

If cb.Type = msoBarTypeNormal Then If Not cb.BuiltIn Then

CustomToolbars = Count End Function

0 0

Post a comment