Hide Menu Bar, Tool Bar, Ribbon

Jeffrey Mahoney

Well-known Member
Joined
May 31, 2015
Messages
3,142
Office Version
  1. 365
Platform
  1. Windows
Is there a VBA equivalent to CTRL-SHIFT-F1 which hides the ribbon and the statusbar? That keyboard shortcut is great because I can still click on the black bar at the top to see the full ribbon.

The only code I've found is below. No mouse use and no keyboard shortcut to reverse.

Sendkeys did not work for me using Application.Sendkeys "+^{F1}"

VBA Code:
Public FullScreen As Boolean

Sub ToggleFullScreen()
  FullScreen = Abs(FullScreen) - 1
  Application.DisplayFullScreen = FullScreen
End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
VBA Code:
Sub RibbonAndQATAndStatusBar_Hide()
    Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",false)"
    Application.DisplayStatusBar = false
End Sub

Sub RibbonAndQATAndStatusBar_Show()
    Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",true)"
    Application.DisplayStatusBar = true
End Sub
 
Upvote 0
Thank you for that pbornemeier. I saw that code also. It is the same as Application.DisplayFullScreen. It won't let me temporarily use the ribbon by clicking on it.
 
Upvote 0
Thank you for that pbornemeier. I saw that code also. It is the same as Application.DisplayFullScreen. It won't let me temporarily use the ribbon by clicking on it.
When you say sendkeys does not work for you? what happens exactly? If you are running the macro from the VBE, that would not work because the focus is not on the Workbook/worksheet where the sendleys can have an effect

I tested using a button inserted on the worksheet(that would not be the ideal way), and I also added it to macro to the Quick Access toolbar and that works. it all depends on your exact use case
 
Upvote 0
When I run the macro from a workbook, not VBA, It does set the full screen mode I want, but it also toggles my numlock on and off
 
Upvote 0
The strange part of this is if I first turn off my numlock, the code below won't toggle the numlock. When my numlock is on, it does.
Application.Sendkeys "+^{F1}"
 
Upvote 0
run it like this

VBA Code:
Application.Sendkeys "+^{F1}"
Doevents
Application.Sendkeys "+^{F1}"

Or with shellobject(will not toggle numlock)

VBA Code:
CreateObject("WScript.Shell").SendKeys  "+^{F1}"
 
Upvote 0
Solution
@JEC
Well the CreateObject line worked in that it didn't actually toggle my numlock. My laptop displays an on screen notification for numlock and capslock. The notification for the numlock shows it being toggled, but remains unchanged.

Thank you
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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