When programming an Excel-file with links between sheets and assorted macros for whatever is needed you may want the file to behave as a program so that users can not access the ribbon even by double-clicking on the top bar. Protect the code from being accessed by pressing alt-F8 or alt-F11. Make sure you can run the macro show_sheets_and_ribbon () from the opening sheet before continuing to step 3
Step 1: Code In "This Workbook"
Private Sub Workbook_Open()
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
Application.ScreenUpdating = False
Application.DisplayFormulaBar = False
ActiveWindow.WindowState = xlMaximized
Application.DisplayFullScreen = True
Step 2: Code for Yourself as Admin for Easy Access to All Sheets
Sub show_sheets_and_ribbon ()
Application.WindowState = xlMaximized
Application.DisplayFullScreen = False
Dim Password As String
'change "password" to whatever....
Do Until Password = "password"
Password = InputBox("Admin only!! - Password required", "Password", "????????")
If Password = "" Then
Hide_sheets
Exit Sub
End If
Loop
Application.ScreenUpdating = False
Dim wsSheet As Worksheet
For Each wsSheet In ActiveWorkbook.Worksheets
wsSheet.Visible = xlSheetVisible
Next wsSheet
ActiveWindow.DisplayWorkbookTabs = True
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
Application.ScreenUpdating = True
End Sub
Sub Hide_sheets()
'Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
Application.ScreenUpdating = False
Dim ws As Worksheet
For Each ws In Worksheets
ws.Visible = True
Next
For Each ws In Worksheets
'providing your first sheet is "Menu" and thats where the control for this macro is.
If ws.Name <> "Menu" Then ws.Visible = False
Next
ActiveWindow.DisplayWorkbookTabs = False
Application.ScreenUpdating = True
Application.DisplayFullScreen = True
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
End Sub
Step 3: Code in All Subs for Changing Sheet
First line in all subs to change sheet:
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
Want to master Microsoft Excel and take your work-from-home job prospects to the next level? Jump-start your career with our Premium A-to-Z Microsoft Excel Training Bundle from the new Gadget Hacks Shop and get lifetime access to more than 40 hours of Basic to Advanced instruction on functions, formula, tools, and more.
Other worthwhile deals to check out:
- 97% off The Ultimate 2021 White Hat Hacker Certification Bundle
- 98% off The 2021 Accounting Mastery Bootcamp Bundle
- 99% off The 2021 All-in-One Data Scientist Mega Bundle
- 59% off XSplit VCam: Lifetime Subscription (Windows)
- 98% off The 2021 Premium Learn To Code Certification Bundle
- 62% off MindMaster Mind Mapping Software: Perpetual License
- 41% off NetSpot Home Wi-Fi Analyzer: Lifetime Upgrades
Be the First to Comment
Share Your Thoughts