Forum Discussion
ADumith
May 10, 2023Iron Contributor
Dashboard customization
Hello everyone,
I have a dashboard made in Excel, so I wonder if there is any way to:
1.- Set disable the ribbon when the user opens the file.
2.- Lock the file so that the user can only navigate between pages and use the filter controls.
Thank you in advance,
- NikolinoDEGold Contributor
You can add the following code to the ThisWorkbook object in the Visual Basic editor:
press "Alt + F11" to open the Visual Basic Editor and then insert the code in "ThisWorkbook".
Private Sub Workbook_Open() Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)" End Sub
This will hide the ribbon when the user opens the file. To show the ribbon again, the user can right-click on any of the tabs and select “Customize the Ribbon”.
As for locking the file so that the user can only navigate between pages and use filter controls, you can protect the workbook structure.
This will prevent users from adding, deleting, hiding, or renaming worksheets.
To do this, go to Review –> Protect Workbook and enter a password if desired.
Hope it helps you!
- ADumithIron ContributorHello NikolinoDE,
Thank you so much.
I was able to hide the ribbon but I can't get them back, so I wonder what tabs are you making reference?
Thank you again.- NikolinoDEGold Contributor
For close with open file
Private Sub Workbook_Open() Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)" End Sub
for open with closing file
Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)" End Sub
Insert this in ThisWorkbook and so you can have close the ribbon if you open the file and its is open again for the other files if you close the file.