+ Reply to Thread
Results 1 to 9 of 9

show specific commandbars

  1. #1
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    show specific commandbars

    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.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: show specific commandbars

    If you want to ensure all the others are invisible then you will have to loop.
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: show specific commandbars

    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?

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: show specific commandbars

    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.

  5. #5
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: show specific commandbars

    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.

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: show specific commandbars

    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.

  7. #7
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: show specific commandbars

    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?

  8. #8
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: show specific commandbars

    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.
    Attached Images Attached Images

  9. #9
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: show specific commandbars

    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.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1