I have a list of CommandBars that I would like to make visible while hiding all others.
Is there some way to accomplish this without cycling through every CommandBar and checking to see if it's in my list to set .Visible?
I have a list of CommandBars that I would like to make visible while hiding all others.
Is there some way to accomplish this without cycling through every CommandBar and checking to see if it's in my list to set .Visible?
Last edited by foxguy; 06-06-2011 at 03:57 AM.
If you want to ensure all the others are invisible then you will have to loop.
Everyone who confuses correlation and causation ends up dead.
Hi Romper;
I kind of figured that was the answer.
I just discovered the FindControls(). It should give me a collection of all the visible Controls. But I'm not sure if it's quicker to loop through all the visible controls, and extract the CommandBars from them, or loop through all the CommandBars.
I don't suppose you can think of a way to get a collection of all visible CommandBars without having to loop through every one?
I think you'd be better off looping through all the commandbars - the time taken should be negligible (hundredths of a second). In my setup there are more visible controls than there are commandbars, so it should be quicker to iterate the bars.
Hi Romper;
Actually CommandBars.FindControls(Visible:=True) does produce a collection of Controls that are visible and only those on visible CommandBars and it doesn't drill down through the Controls for sub Controls, so I think that will be quicker. There are 118 CommandBars, but I never have that many Controls visible at one time.
I can loop through all the visible Controls extracting the CommandBars, and hide those CommandBars that are not on my list of CommandBars, then loop through my list making all of them visible.
Do you see anything wrong with that idea?
Last edited by foxguy; 06-06-2011 at 03:35 AM.
No, if it's that way round for you then fine. (I know what FindControls does.)
For me, I have about 30 more visible controls than there are commandbars, so it would be slower I suspect. Either way I doubt there's a noticeable difference.
Hi Romper;
I'm curious. How do you work with over 140 visible controls? And don't they take up a lot of real estate on your screen?
My question to you would be how do you work without that many?
I have 4 rows of toolbars at the top and one row at the bottom of the main window. Looks like the attached.![]()
I guess I'm not as good as I thought I was.
Every time I find myself looking through a sub menu often, I create a button to shortcut to the action. Maybe my screen will look more like yours in a few years.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks