|Excel and Office
Checking for the existence of a given toolbar
Q: Can someone explain to me how I would go about doing something such as this, the EXISTS method does not exist for commandbars?
If Not Application.CommandBars("Reports").Exists Then
CommandBars("Reports").Visible = True
A: Use this line of code just before your line which makes it visible:
On Error Goto MakeToolbar
That way it will make it visible if it exists, or fly off to the MakeToolbar part if it doesn't. (If this subroutine goes on to do other things beyond checking for the toolbar's existence, you might want to consider resetting the error checking once past this point.) At the end of your subroutine, add the following lines: