Hide Excel Title bar, maximize, minimize, close buttons

FTSCH

New Member
Joined
Aug 10, 2017
Messages
8
I have been using API code similar to

https://www.mrexcel.com/forum/excel-questions/6148-possible-hide-excel-title-bar.html

successfully to hide the Title Bar (min, max, close, menu buttons) in Excel 2013/2016 running Win 7/Win 10 and it has been working without issue on tablets when rotating from landscape to portrait to landscape modes. It has worked fine on windows versions up to Win 10 build version 1607.xxxxx.xxx and. Now with Win 10 build version 1703.xxxxx.xxxx when switching from landscape to portrait back to landscape mode the excel application window size remains at the width of the portrait mode. I have tried (I'm not well versed in API programming) to update the declare functions for win 64 but that did not work either. Any suggestions and is anyone else experiencing any abnormalities with Excel 2013 (15.0.4953.1000)/2016 (1707.8326.2059) and Win 10 build 1703.15063.xxx?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I am running Win 10, 64 Bit, Excel 2013, 32 Bit and have had no problems with the screen display of Excel. To my knowledge, th screen display has never changed when the print parameters of Landscape and Portrait were toggled, except in Print Preview mode. In normal mode there is no difference because the orientation does not affect the Excel grid of columns and rows. You should be able to hide the title bars with code like the following

Code:
With Application
        .DisplayFullScreen = True
        .DisplayFormulaBar = False
        .DisplayStatusBar = False
    End With
 
Last edited:
Upvote 0
I am running Win 10, 64 Bit, Excel 2013, 32 Bit and have had no problems with the screen display of Excel. To my knowledge, th screen display has never changed when the print parameters of Landscape and Portrait were toggled, except in Print Preview mode. In normal mode there is no difference because the orientation does not affect the Excel grid of columns and rows.
This has nothing to do with printing in landscape or portrait mode. This is using the API's to remove the Excel Title bar, min, max, close, menu buttons and using Excel on tablets and holding the tablet and switching between landscape (horizontal) and portrait (vertical) and having the screen adjust back to its mode's width.
 
Upvote 0
This has nothing to do with printing in landscape or portrait mode. This is using the API's to remove the Excel Title bar, min, max, close, menu buttons and using Excel on tablets and holding the tablet and switching between landscape (horizontal) and portrait (vertical) and having the screen adjust back to its mode's width.
These API's have other advantages such as the user cannot min or max the excel application window nor can the workbook be shut down via the task bar.
 
Upvote 0
You are out of my league with the tablets, never used one. Also have never bothered with diminishing the window by code, usually do that with the mouse pointer for my purposes. I can conceive that for advanced use, it could be advantageous to resize the windows by code, maybe display more than one at a time, etc. Just never had the occasion to do it.

regards, JLG
 
Upvote 0
You are out of my league with the tablets, never used one. Also have never bothered with diminishing the window by code, usually do that with the mouse pointer for my purposes. I can conceive that for advanced use, it could be advantageous to resize the windows by code, maybe display more than one at a time, etc. Just never had the occasion to do it.

regards, JLG
Thanks for you consideration with regard to this issue. Appreciate it.
Thanks,
FTSCH
 
Upvote 0
Greetings FTSCH,

Are you still working on this? If yes:

I have no access to WIN 10 (Using WIN 7). I do not have a tablet, nor any access to one to test, so am unlikely to be able to help effectively. That said...

...I have tried (I'm not well versed in API programming) to update the declare functions for win 64 but that did not work either.

Windows being 64-bit does not matter (other than of course it is required to run Excel in 64-bit). Excel being installed in 64-bit is what matters. Are the copies of Excel 2013/2016 installed in 64-bit mode, or the default 32-bit mode?

Now with Win 10 build version 1703.xxxxx.xxxx when switching from landscape to portrait back to landscape mode the excel application window size remains at the width of the portrait mode.

Could you show the entire code that was working? I think for anyone to be able to help, we would need to see what hook or timer or ??? was being used to check the tablet's orientation.

Mark
 
Upvote 0
Greetings FTSCH,

Are you still working on this? If yes:

I have no access to WIN 10 (Using WIN 7). I do not have a tablet, nor any access to one to test, so am unlikely to be able to help effectively. That said...



Windows being 64-bit does not matter (other than of course it is required to run Excel in 64-bit). Excel being installed in 64-bit is what matters. Are the copies of Excel 2013/2016 installed in 64-bit mode, or the default 32-bit mode?



Could you show the entire code that was working? I think for anyone to be able to help, we would need to see what hook or timer or ??? was being used to check the tablet's orientation.

Mark

Yes I'm still working on this. The tablets and desktops that I'm using are running Win 10 x 64 and Excel 2013-2016 x 32 and have had no problems with the code until Win 10 1703.xxxxx.xxx and after reading the many, many blogs and posts, I guess many others are having issues with Win 10x64 ver 1703.xxxxx.xxx.

Here is the code I used as adapted and used by others and posted with various renditions on several sites as to the functionality and usage:


Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
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 GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SetFocus Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hWndLock As Long) As Long

Private Const GWL_STYLE As Long = (-16) '// The offset of a window's style
Private Const GWL_EXSTYLE As Long = (-20) '// The offset of a window's extended style
Private Const WS_CAPTION As Long = &HC00000 '// Title bar bit
Private Const WS_SYSMENU As Long = &H80000 '// System menu bit
Private Const WS_THICKFRAME As Long = &H40000 '// Sizable frame bit
Private Const WS_MINIMIZEBOX As Long = &H20000 '// Minimize box bit
Private Const WS_MAXIMIZEBOX As Long = &H10000 '// Maximize box bit
Private Const WS_EX_TOOLWINDOW As Long = &H80 '// Tool Window: small titlebar bit
Private Const SC_CLOSE As Long = &HF060 'Constant to identify the Close menu item
'// Set or clear a bit from a style flag
Private Sub SetBit(ByRef lStyle As Long, ByVal lBit As Long, ByVal bOn As Boolean)

If bOn Then
lStyle = lStyle Or lBit
Else
lStyle = lStyle And Not lBit
End If

End Sub
Public Sub SetStyle()

Dim lStyle As Long, hMenu As Long

'Get the basic window style
lStyle = GetWindowLong(Application.hwnd, GWL_STYLE)

If lStyle = 0 Then
MsgBox "Unable to determine application window handle...", vbExclamation, "Error"
Exit Sub
End If

'// Build up the basic window style flags for the form adapted to the application window not UF's

SetBit lStyle, WS_CAPTION, False
SetBit lStyle, WS_SYSMENU, False
SetBit lStyle, WS_THICKFRAME, False
SetBit lStyle, WS_MINIMIZEBOX, False
SetBit lStyle, WS_MAXIMIZEBOX, False

'Set the basic window styles
SetWindowLong Application.hwnd, GWL_STYLE, lStyle

'Get the extended window style
lStyle = GetWindowLong(Application.hwnd, GWL_EXSTYLE)


'// Handle the close button
'// hMenu = GetSystemMenu(Application.hWnd, 1)

'// Not wanted - delete it from the control menu
hMenu = GetSystemMenu(Application.hwnd, 0)
DeleteMenu hMenu, SC_CLOSE, 0&


'Update the window with the changes
DrawMenuBar Application.hwnd
SetFocus Application.hwnd

End Sub


Thank you in advance
FTSC
 
Upvote 0

Forum statistics

Threads
1,214,516
Messages
6,119,978
Members
448,934
Latest member
audette89

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