Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide ribbon when excel opens - excel 2016 [duplicate]

Tags:

excel

vba

I am trying to hide my ribbons upon my workfile opening.

I've followed the below link but keep getting run-time error 91. VBA auto hide ribbon in Excel 2013

I've written the following code on the "thisworkbook" mode, but cannot get the line to work.

 Private Sub Workbook_Open()
 CommandBars.ExecuteMso "HideRibbon"
 End Sub
like image 387
PGD15 Avatar asked Mar 26 '26 08:03

PGD15


1 Answers

You need to add Application in front of CommandBars.

 Private Sub Workbook_Open()
    application.CommandBars.ExecuteMso "HideRibbon"
 End Sub
like image 50
PGD15 Avatar answered Mar 27 '26 21:03

PGD15



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!