Mega Code Archive

 
Categories / VisualBasic Script / Application
 

Determines if a given command bar name exists

Sub TestCommandBarUtilities()      Debug.Print CommandBarExists("Worksheet Menu Bar")      Debug.Print CommandBarExists("Formatting")      Debug.Print CommandBarExists("Not a command bar")  End Sub  Function CommandBarExists(sName As String) As Boolean      Dim s As String      On Error GoTo bWorksheetExistsErr      s = Application.CommandBars(sName).Name      CommandBarExists = True      Exit Function  bWorksheetExistsErr:      CommandBarExists = False  End Function