How to auto hide ribbon but only for a specific workbook and only for one worksheet in that workbook when workbook opens?
When I use the below code is working as expected and hide the ribbon but when I open another excel files the ribbon in the files is also hidden.
Private Sub Workbook_Open()
Application.CommandBars.ExecuteMso "HideRibbon"
End Sub
Name the worksheet in a unique way e.g."aaa" and then write inside the
ThisWorkbook
module the following:which is tested in Excel 2007 and Excel 2010 and works fine.
By the way, having tested
Application.CommandBars.ExecuteMso "HideRibbon"
in Excel 2007 and Excel 2010, throws an error, which version do you use?If you prefer, replace the above 'hide/show lines', with those that work in your version according to the comments.