Results 1 to 2 of 2
2005-01-01, 18:43 #1
- Join Date
- Jan 2005
- Thanked 0 Times in 0 Posts
Disappeared custum toolbar (english/Excel 2000/V1)
In a VBA application I created a custum user toolbar. Everything works fine. After closing the application, the custum toolbar is deleted and the Excel toolbars pops up again. I changed the macro in the way that for a certain 2nd toolbar to show up, the first one was disabled hoping it was still visible on top (I used the enabled false property), but...the toolbar disappeared and doesn't show up whenever I run the application again, not even after restarting Excel or restart the PC.
When the add toolbar command is reached, the program jumps out of the subroutine without making/showing the toolbar.
The toolbar isn't even found in the Excels toolbars custimization.
What's going on? How can I solve this?
2005-01-01, 19:09 #2
- Join Date
- Mar 2002
- Thanked 30 Times in 30 Posts
Re: Disappeared custum toolbar (english/Excel 2000/V1)
Welcome to Woody's Lounge.
If a toolbar is disabled, it doesn't show in the list of available toolbars. You must use code to enable the toolbar again:
Application.CommandBars("NameOfCustomToolbar").Ena bled = True
If you want the toolbar visible, but disabled, you will have to disable all controls on the toolbar in a loop:
Sub ToggleControls(ToolbarName As String, f As Boolean)
Dim ctl As CommandBarControl
For Each ctl in Application.CommandBars(ToolbarName)
ctl.Enabled = f
Set ctl = Nothing
To disable all controls, use
ToggleControls "NameOfCustomToolbar", False
and to enable them again:
ToggleControls "NameOfCustomToolbar", True
Replace NameOfCustomToolbar with the name of your custom toolbar.