You can remove all the Toolbars and the Menu Bar.
I think these do what you want.
They remove/replace all the "visible" Toolbars, disable the worksheet Menu Bar and allow you to use your own custom Caption on the App.
They contain ample comments so you should be able to follow them.
Be careful!
Private Sub Workbook_Open()
'
' When the workbook is opened turn screen updating off. Make the Parameters worksheet active. Record in the relevant
' table on the worksheet whether each built in Toolbar is visible or not. Hide the Formula Bar and Status Bar. Hide
' all the built in Toolbars that are visible and disable the Worksheet Menu Bar. Make the Menu worksheet active,
' turn screen updating on and show the MenuForm.
'
Application.ScreenUpdating = False ' Turn off screen updating
Worksheets("Parameters").Activate ' Make the Parameters worksheet active.
Dim R As Range ' Declare the local variable R as a range.
Set R = ActiveSheet.Range("D45") ' Set the local variable R equal to cell D45.
' The following "For" loop records whether each Toolbar is visible or not. It checks whether each Toolbar is
' visible and makes the value of the cells, referenced from the local variable r, equal to the boolean result
' (ie True or False). Only the first 20 Toolbars are interrogated.
For i = 1 To 20
R.Cells(i, 1).Value = Application.CommandBars(i).Visible
Next
With Application
.DisplayFormulaBar = False ' Hide the Formula Bar.
.DisplayStatusBar = False ' Hide the Status Bar.
End With
' The following "For" loop hides all the Toolbars.
For Each bar In Application.CommandBars ' For each command bar.
If bar.Enabled Then
' Specifies that when a run-time error occurs, control goes to the statement immediately following the
' statement where the error occurred where execution continues. This line is required because the
' the first command bar accessed is the Worksheet Menu Bar which cannot be hidden and generates a run-
' time error.
On Error Resume Next
If bar.BuiltIn And bar.Visible Then bar.Visible = False
End If
Next
Application.CommandBars("Worksheet Menu Bar").Enabled = False ' Disable the Worksheet Menu Bar.
Worksheets("Menu").Activate ' Make the Menu worksheet active. This is a "blank" worksheet with no gridlines.
Worksheets("Menu").EnableSelection = xlUnlockedCells ' Only unlocked cells can be selected on the 'Menu' worksheet.
Application.Caption = "Give Your App. It's Own Caption!"
Application.ScreenUpdating = True ' Turn on screen updating.
Beep
MenuForm.Show ' Show the MenuForm Form. This shows a menu on the "blank" worksheet.
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'
' When the workbook is closed turn screenupdating off. Make the Parameters worksheet active. Enable the Worksheet
' Menu Bar. Make the Toolbars that were visible when the file was open visible again by using the boolean values
' stored in the relevant table on the worksheet. Display the Formula Bar and Status Bar. Make the Menu worksheet
' active and turn screen updating on.
'
' Application.ScreenUpdating = False ' Turn off screen updating
If ThisWorkbook.Saved = False Then ' If the workbook has not been saved.
intResponse = MsgBox("Do you want to save the changes made to '" & ActiveWorkbook.Name & "'?", 68, "Save " _
& "File ")
End If
If intResponse = vbYes Then Save_File ' If user responds "Yes" save the file.
Worksheets("Parameters").Activate ' Make the Parameters worksheet active.
Application.CommandBars("Worksheet Menu Bar").Enabled = True ' Enable the Worksheet Menu Bar.
Dim R As Range ' Declare the local variable r as a range.
Set R = ActiveSheet.Range("D45") ' Set the local variable r equal to cell D45.
' The following "For" loop makes each Toolbar that was visible when the file was opened visible again. It reads
' the boolean value in the cell referenced from the local variable r and makes the relevant Toolbar visibility
' equal to this value (ie True or False). Only the first 20 Toolbars are interrogated.
For i = 1 To 20
' Specifies that when a run-time error occurs, control goes to the statement immediately following the
' statement where the error occurred where execution continues. This line is required because the
' the Toolbar table on the Parameters worksheet is updated to show which Toolbars were visible when the file
' is opened. Consequently if the file is not saved the user is asked if they want to save. This generates
' a run-time error.
On Error Resume Next
Application.CommandBars(i).Visible = R.Cells(i, 1).Value
Next
With Application
.DisplayFormulaBar = True ' Display the Formula Bar.
.DisplayStatusBar = True ' Display the Status Bar.
End With
Worksheets("Menu").Activate ' Make the Menu worksheet active.
Application.ScreenUpdating = True ' Turn on screen updating
End Sub
Bookmarks