Tuning Off Toolbars

P

Phil Hageman

I need to add a line to an Auto_Open() that turns off all
toolbars. What would the code be?

Thanks,
Phil
 
R

Ron de Bruin

Hi Phil

Try this

Dim bar As CommandBar
For Each bar In Application.CommandBars
bar.Enabled = False
Next

Set it to True to get them back
 
R

Ron de Bruin

Use this if you want to keep the menubar

Dim a As Integer
For a = 2 To Application.CommandBars.Count
CommandBars(a).Enabled = False
Next
 
P

Phil Hageman

Ron, Thanks for your reply - appreciate your time. I want
to keep the menu bar and turn off all tool bars. I've
tried to enter your code but can't get it to work. Below
is the entire sub (copy/paste, underscores absent). Could
you put it where it belongs? Again, Thanks.

Sub Auto_Open()

'Turn off updating so code runs faster
Application.ScreenUpdating = False

For Each ws In Worksheets
If ws.Visible = xlSheetVisible Then
ws.Select
Application.GoTo ws.Range("A1"), True 'Active
cell is A1
ActiveWindow.DisplayGridlines = False 'Turns
off gridlines
End If
Next

'To open the workbook on the Scorecard worksheet
Worksheets("Scorecard").Select

'To change default color pink (index number 7) to
light red (for charts)
ThisWorkbook.Colors(7) = RGB(255, 124, 128)

'In percent formatted cells, returns %, if decimal or
whole number entered.
Application.AutoPercentEntry = True

'Restore screen updating
Application.ScreenUpdating = True

End Sub
-----Original Message-----
Use this if you want to keep the menubar

Dim a As Integer
For a = 2 To Application.CommandBars.Count
CommandBars(a).Enabled = False
Next
wrote in message [email protected]...
 
R

Ron de Bruin

Place the subs in a normal module Phil

Sub Auto_Open()
Dim a As Integer
For a = 2 To Application.CommandBars.Count
Application.CommandBars(a).Enabled = False
Next
End Sub

Sub Auto_close()
Dim a As Integer
For a = 2 To Application.CommandBars.Count
Application.CommandBars(a).Enabled = True
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top