Disable all controls and menus except the "close", "minimize" and "maximize"

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
So I have been digging the web for a while now and I can't find the best way to handle the above challenge yet.

Can it be possible to disable all the menus except the control box items as indicated in the header of this thread?

Regards
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
.
Paste these macros in the THISWORKBOOK module :

Code:
Option Explicit


Private Sub Workbook_Open()
    'These commands disable the menu bar.
   ' Application.DisplayFormulaBar = False
   ' Application.DisplayStatusBar = False
    Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
End Sub


Private Sub Workbook_BeforeClose(Cancel As Boolean)
    'These commands re-enable the menu bar so other workbooks
    'won't be affected.
    'Application.DisplayFormulaBar = True
    'Application.DisplayStatusBar = True
    Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
End Sub
 
Upvote 0
.
Paste these macros in the THISWORKBOOK module :

Code:
Option Explicit


Private Sub Workbook_Open()
    'These commands disable the menu bar.
   ' Application.DisplayFormulaBar = False
   ' Application.DisplayStatusBar = False
    Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
End Sub


Private Sub Workbook_BeforeClose(Cancel As Boolean)
    'These commands re-enable the menu bar so other workbooks
    'won't be affected.
    'Application.DisplayFormulaBar = True
    'Application.DisplayStatusBar = True
    Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
End Sub


Okay thanks.

I have these codes already.

They do hide those bars and menus.

I am hoping to have the ribbon shown but make all the menus inactive.
 
Upvote 0
Perhaps this ?

Code:
Option Explicit


Private Sub Workbook_Activate()
    If Application.CommandBars("Ribbon").Height > 100 Then
        SendKeys "^{F1}"
        DoEvents
    End If
End Sub


Private Sub Workbook_Deactivate()
    If Application.CommandBars("Ribbon").Height < 100 Then
        SendKeys "^{F1}"
        DoEvents
    End If
End Sub
 
Upvote 0
Sure I did.

And also with the workbook you posted. It only minimizes the ribbon to leave only the menus.

Meanwhile,
I would wish to have the menus deactivated.

I shouldn't be able to interact with them with the mouse.

I should only be able to access them back with a reverse code.

Kind of scary I think.:)
 
Upvote 0
.
The code in Post #2 will do that. It might not look like you were expecting, but it is the answer.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top