Formula Bar & Status Bar still showing while using VBA Code for hiding ribbon

sauj99

New Member
Joined
Oct 23, 2020
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I want to hide formula bar, status bar and ribbon in one of my workbooks.

I am using the following code in ThisWorkbook module to hide the formula bar, status bar & ribbon but the Formula Bar & Status Bar still shows.
Incase I hide the Formula bar in another workbook, its hidden in the workbook in question too but the status bar still shows.

VBA Code:
Option Explicit


Private Sub Workbook_Open()
' Application.DisplayFormulaBar = False
' Application.DisplayStatusBar = False
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
End Sub


Private Sub Workbook_BeforeClose(Cancel As Boolean)
'Application.DisplayFormulaBar = True
'Application.DisplayStatusBar = True
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
End Sub

I am using the following code to bring them back.

VBA Code:
Option Explicit
Sub shwMenu()
 Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"


End Sub
Sub hideMenu()
 Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
End Sub

Where am I going wrong?
I would really appreciate if somebody could help.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I may be missing something here, but I think you're just missing your Application.DisplayFormulaBar and DisplayStatusBar lines. They're commented out in the first two procedures, but if you uncomment them (remove the ') they work for me. You should be able to just add them to your shwMenu and hideMenu procedures.
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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