+ Reply to Thread
Results 1 to 6 of 6

Remove Toolbars

  1. #1
    Registered User
    Join Date
    03-03-2007
    Location
    Winnipeg, Manitoba, Canada
    Posts
    12

    Remove Toolbars

    When i open my workbook, i would like to remove all toolbars and only display a custom toolbar that is created with a macro. I have all the coding i need EXCEPT for removing the toolbars. I have considered using the "Application.Commandbar("name of bar").visible = false" lines, but it seems to be a lot of coding as i would have to do this for each toolbar to ensure they are not displayed. My question is: Is there one line that I could use to apply the "visible = false" to all of the toolbars?

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524
    here's a start

    http://www.ozgrid.com/VBA/toolbar-remove-restore.htm

  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon Jedody

    EXTREME CAUTION SHOULD BE EXERCISED IN THIS AREA as any changes made to toolbars will not be undone in subsequent Excel sessions, it is so easy to completely FUBAR your (or even worse, someone else's) Excel environment.

    It may seem like a lot of messing about to have to hide each one by hand, and you could use a loop to go through all objects and hide them all, but on exiting you are going to have to reinstate them all again. How are you going to do that if you don't know which toolbars were visible to start with? If yo truly want to go with this (and use a loop) and do a proper job you're going to have to determine the state (and location) of every toolbar and reinstate them before exiting your workbook.

    Far easier to determine what the user can and can't do and work on it that way.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  4. #4
    Registered User
    Join Date
    03-03-2007
    Location
    Winnipeg, Manitoba, Canada
    Posts
    12
    Thanks Davesexcel, that appears to be EXACTLY what i was looking for - code to remove AND restore them on close.

    This website is awesome, very helpful!

  5. #5
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi Jedody

    So you want to remove the MENUBAR, not the TOOLBARS (note, plural)? Not quite what you asked for.
    Big, big difference.

    DominicB

  6. #6
    Registered User
    Join Date
    03-03-2007
    Location
    Winnipeg, Manitoba, Canada
    Posts
    12
    Hi dominicb

    I want to remove the TOOLBARS, not the MENUBAR. I've just slightly modified the code that davesexcel directed me to. Thanks for your help.
    Last edited by Jedody; 03-03-2007 at 03:41 PM.

+ 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