1,105,380 Community Members

List all toolbars currently visible?

Member Avatar
Swoop_GB
Newbie Poster
12 posts since Feb 2011
Reputation Points: 6 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Is there a simple way to list all the toolbars a user currently has visible?


I'm trying to hide everything on screen appart from my worksheet, including the file menu. I've found a way to do it (custom toolbar, hide everything else) but need to be able to restore the original toolbar config when the user exits my app (cos people HATE it when you screw with their setup).

My app is going to run on multiple versions of excel (possibly every version of excel from 97 through to the latest) and I'm developing in excel XP (2003). I'm using the code:

if application.commandbars("toolbar name").visible = true then
   ' {log it to somewhere the user can't see}
     application.commandbars("toolbar name").visible = false
   ' {repeat for all the toolbars I know the names of}
end if

however......I only have one version of excel to play with so not only could a user be running a toolbar not native to excel XP (so I won't know the name of it) but also custom toolbars, which also need to be hidden.

So.....as I say, is there a way to list all toolbars visible?

Member Avatar
ChrisPadgham
Posting Pro in Training
450 posts since Sep 2009
Reputation Points: 113 [?]
Q&As Helped to Solve: 90 [?]
Skill Endorsements: 8 [?]
 
0
 

You can try experimenting with this, it might need some playing with to get it working

Dim thiscombar As CommandBar
For Each thiscombar In Application.CommandBars
     thiscombar.Visible = False
Next thiscombar
You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article