This example deletes all custom command bars that aren't visible.
foundFlag = False
deletedBars = 0
For Each bar In CommandBars
If (bar.BuiltIn = False) And (bar.Visible = False) Then
bar.Delete
foundFlag = True
deletedBars = deletedBars + 1
End If
Next
If Not foundFlag Then
MsgBox "No command bars have been deleted."
Else
MsgBox deletedBars & " custom command bar(s) deleted."
End If