Results 1 to 16 of 16

Thread: Show/Hide toolbars [solved]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Location
    Lucenec, Slovakia
    Posts
    154

    Resolved Show/Hide toolbars [solved]

    Hi guys,

    I am preparing my own toolbar in Excel using VBE. My intention is to prepare small macro which show/hide already visible toolbars and them make visible only my custom toolbar. I have the same problem with menus.
    How can I determine or make list of visible menus or toolbars and then make them hidden or visible.

    Thanks

    Boris
    Last edited by bolcskei; May 27th, 2005 at 03:32 AM.

  2. #2
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Show/Hide toolbars

    U can do like this:

    VB Code:
    1. CommandBars("Some cmd bar").Visible = False
    2. CommandBars("Some cmd bar").Visible = True

    etc. etc.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Location
    Lucenec, Slovakia
    Posts
    154

    Re: Show/Hide toolbars

    Quote Originally Posted by Pradeep1210
    U can do like this:

    VB Code:
    1. CommandBars("Some cmd bar").Visible = False
    2. CommandBars("Some cmd bar").Visible = True

    etc. etc.
    I would like to make macro wich determine the name of visible menus or toolbars.

    Boris

  4. #4
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Show/Hide toolbars

    Quote Originally Posted by bolcskei
    I would like to make macro wich determine the name of visible menus or toolbars.

    Boris
    VB Code:
    1. For Each cb in CommandBars
    2.     If cb.Visible Then
    3.         'do ur stuff here
    4.         ' like storing it somewhere or whatever...
    5.     End If
    6. Next

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Location
    Lucenec, Slovakia
    Posts
    154

    Exclamation Re: Show/Hide toolbars

    Quote Originally Posted by Pradeep1210
    VB Code:
    1. For Each cb in CommandBars
    2.     If cb.Visible Then
    3.         'do ur stuff here
    4.         ' like storing it somewhere or whatever...
    5.     End If
    6. Next
    Thank you for your clue. I did the following code. The problem is, it showing me only excel build-in and my toolbars only. It do not showing me ADX Toys2 and Business Functions toolbars. Do you have any idea?

    Boris

    VB Code:
    1. Sub show_commandbars()
    2. Dim bar As CommandBar
    3. Dim i, j
    4. i = 15
    5. j = 10
    6. For Each bar In Application.CommandBars
    7.     If bar.Visible Then Sheets("menu").Cells(i, j + 1).Value = bar.Name
    8.     i = i + 1
    9. Next bar
    10. End Sub

  6. #6
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Show/Hide toolbars

    Quote Originally Posted by bolcskei
    Thank you for your clue. I did the following code. The problem is, it showing me only excel build-in and my toolbars only. It do not showing me ADX Toys2 and Business Functions toolbars. Do you have any idea?

    Boris
    I havn't come across any such command bars. If these are some custom commandbars, ensure that they exist. Right click any empty area on any commandbar, al ist of comandbars appears. Ensure that these are in that list.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Location
    Lucenec, Slovakia
    Posts
    154

    Cool Re: Show/Hide toolbars

    Quote Originally Posted by Pradeep1210
    I havn't come across any such command bars. If these are some custom commandbars, ensure that they exist. Right click any empty area on any commandbar, al ist of comandbars appears. Ensure that these are in that list.
    I have checked the toolbars and they are in the list. I have forgotten to write these toolbars are freeware add-ins.

  8. #8
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Show/Hide toolbars

    Quote Originally Posted by bolcskei
    I have checked the toolbars and they are in the list. I have forgotten to write these toolbars are freeware add-ins.
    What does this show in the debug window?

    VB Code:
    1. Print commandbars("Business Functions").Visible
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Location
    Lucenec, Slovakia
    Posts
    154

    Re: Show/Hide toolbars

    Quote Originally Posted by Pradeep1210
    What does this show in the debug window?

    VB Code:
    1. Print commandbars("Business Functions").Visible
    method not valid without suitable object

  10. #10
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Show/Hide toolbars

    Quote Originally Posted by bolcskei
    method not valid without suitable object
    Are u sure these are Commandbars only? I think these might be something else (like a window etc.)

    Can u post the link to URL where u got these?
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Location
    Lucenec, Slovakia
    Posts
    154

    Re: Show/Hide toolbars

    Quote Originally Posted by Pradeep1210
    Are u sure these are Commandbars only? I think these might be something else (like a window etc.)

    Can u post the link to URL where u got these?
    As I wrote before it is a freeware add-ins, downloaded from

    www.businessfunctions.co.uk

  12. #12
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Show/Hide toolbars

    Quote Originally Posted by bolcskei
    As I wrote before it is a freeware add-ins, downloaded from

    www.businessfunctions.co.uk
    I downloaded on my machine and installed it. It works fine. No problems. Maybe it's corrupted on ur system. Pl. try installing it again and check again.

    BTW it's a great tool
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Location
    Lucenec, Slovakia
    Posts
    154

    Re: Show/Hide toolbars

    Quote Originally Posted by Pradeep1210
    I downloaded on my machine and installed it. It works fine. No problems. Maybe it's corrupted on ur system. Pl. try installing it again and check again.

    BTW it's a great tool
    Was you able to list this add-in? I will try your suggestion.

    Here is some other interesing links:

    www.asap-utilities.com
    www.ablebits.com
    www.add-in-express.com

  14. #14
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Show/Hide toolbars

    Quote Originally Posted by bolcskei
    Was you able to list this add-in? I will try your suggestion.

    Here is some other interesing links:

    www.asap-utilities.com
    www.ablebits.com
    www.add-in-express.com
    Yes it lists in the commandbars collection.
    Try this: If it is functioning correctly on ur system, u should see the entry in ur Debug window.
    VB Code:
    1. For Each cb in CommandBars
    2.     Debug.Print cb.Name
    3. Next
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Location
    Lucenec, Slovakia
    Posts
    154

    Re: Show/Hide toolbars

    Quote Originally Posted by Pradeep1210
    Yes it lists in the commandbars collection.
    Try this: If it is functioning correctly on ur system, u should see the entry in ur Debug window.
    VB Code:
    1. For Each cb in CommandBars
    2.     Debug.Print cb.Name
    3. Next
    Thank you verry much! Sorry for your time. The problem was verry stupid.
    I had to i=i+1 give before end if. Without this the program listing me commandbars, but when the bar was invisible it leaving empty cell. The business function and ADX toys was last in the list and was listed approximately at 150th row and I was not scrolling so far and did not see it.
    Many thanks

    Boris

    VB Code:
    1. Sub show_commandbars()
    2. Dim bar As CommandBar
    3. Dim i, j
    4. i = 15
    5. j = 10
    6. For Each bar In Application.CommandBars
    7.     If bar.Visible Then
    8.     Sheets("menu").Cells(i, j + 1).Value = bar.Name
    9.     i = i + 1
    10.     End If
    11. Next bar
    12. End Sub

  16. #16
    Lively Member skv_noida's Avatar
    Join Date
    May 2005
    Location
    Noida, India
    Posts
    76

    Re: Show/Hide toolbars [solved]

    Ya, bolcskei is on right way

Posting Permissions

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



Click Here to Expand Forum to Full Width