VBA: Hiding any visible toolbars except the Standard and Formatting toolbars.

RusselJ

Board Regular
Joined
Aug 5, 2013
Messages
155
Hi All

I have been scratching my head over this one.

With VBA how can I hide any toolbars that are visible, apart from the Standard and Formatting toolbars?

Would appreciate your thoughts

Russel
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Just loop, test the name of the commandbar and set its Visible property as appropriate.
 
Upvote 0
Hi Rory, thanks for your reply.

Could I trouble you for an example as this is beyond my knowledge and the only examples I have been able to find are for hiding all the toolbars!

Russel
 
Upvote 0
Sure - something like this:

Code:
Sub hideEmCowboy()
    Dim cbr                         As Office.CommandBar

    For Each cbr In Application.CommandBars
        If cbr.Type = msoBarTypeNormal Then
            Select Case LCase$(cbr.Name)
                Case "standard", "formatting"
                    cbr.Visible = True
                Case Else
                    If cbr.Visible Then cbr.Visible = False
            End Select
        End If
    Next cbr
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,749
Members
449,050
Latest member
excelknuckles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top