Hide everything other than the top MINIMIZE-EXPAND-CLOSE

Polino

New Member
Joined
Apr 1, 2022
Messages
12
Office Version
  1. 2019
Platform
  1. Windows
I'm doing everything to hide all possible headings and bars, but I cannot HIDE the MINIMIZE-EXPAND-CLOSE at the top right corner of the workbook.
Is it possible or I have no choice than to keep it? or else could they be gray out so they cannot be used?
This is what I'm doing, and it hides everything other than the top MINIMIZE-EXPAND-CLOSE

' Hide the Horizontal Scroll Bar
ActiveWindow.DisplayHorizontalScrollBar = False
' Hide the Vertical Scroll Bar
ActiveWindow.DisplayVerticalScrollBar = False
' Hide the Row/Column Headings
ActiveWindow.DisplayHeadings = False
' Hide the Worksheet Tabs
ActiveWindow.DisplayWorkbookTabs = False
' Hide the Status Bar (bottom of the window)
Application.DisplayStatusBar = False
' Hide the Formula Bar
Application.DisplayFormulaBar = False
' Hide the Ribbon Menu and Quick Access Toolbar
Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",False)"

Quote Reply
Report
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
1- Place this in a new Standard Module:
VBA Code:
Option Explicit

#If VBA7 Then
    #If Win64 Then
        Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongPtrA" (ByVal hwnd As LongLong, ByVal nIndex As Long, ByVal dwNewLong As LongLong) As LongLong
        Private Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongPtrA" (ByVal hwnd As LongLong, ByVal nIndex As Long) As LongLong
    #Else
        Private Declare PtrSafe Function SetWindowLong Lib "USER32.DLL" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
        Private Declare PtrSafe Function GetWindowLong Lib "USER32.DLL" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    #End If
    Private Declare PtrSafe Function DrawMenuBar Lib "user32" (ByVal hwnd As LongPtr) As Long
#Else
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
#End If

Public Property Let FullSheetDisplay(ByVal bFullScreen As Boolean)
    ' Toggle the Horizontal Scroll Bar
    ActiveWindow.DisplayHorizontalScrollBar = Not bFullScreen
    ' Toggle the Vertical Scroll Bar
    ActiveWindow.DisplayVerticalScrollBar = Not bFullScreen
    ' Toggle the Row/Column Headings
    ActiveWindow.DisplayHeadings = Not bFullScreen
    ' Toggle the Worksheet Tabs
    ActiveWindow.DisplayWorkbookTabs = Not bFullScreen
    ' Toggle the Status Bar (bottom of the window)
    Application.DisplayStatusBar = Not bFullScreen
    ' Toggle the Ribbon Menu and Quick Access Toolbar
   ' Application.ExecuteExcel4Macro "show.toolbar(""Ribbon""," & -bFullScreen & ")"
    ' Toggle Full Screeen
    Application.DisplayFullScreen = bFullScreen
    ' Toggle Excel Caption
    ExcelTitleBar = Not bFullScreen
    ' Toggle the Formula Bar
    Application.DisplayFormulaBar = Not bFullScreen
End Property


Private Property Let ExcelTitleBar(ByVal bShow As Boolean)
    Const WS_CAPTION = &HC00000: Const GWL_STYLE = (-16)
    Call SetWindowLong(Application.hwnd, GWL_STYLE, _
        IIf(bShow, (GetWindowLong(Application.hwnd, GWL_STYLE) Or WS_CAPTION), _
        GetWindowLong(Application.hwnd, GWL_STYLE) And (Not WS_CAPTION)))
        Call DrawMenuBar(Application.hwnd)
End Property


2- Now, To toggle the display including the excel titlebar, simply set the FullSheetDisplay Property to TRUE or FALSE as follows
VBA Code:
Sub Test()
    FullSheetDisplay = True  ' or False to restore normal display
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,223
Members
452,620
Latest member
dsubash

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