How to remove the excel icon from the title bar in full screen mode.

ApricityMech

New Member
Joined
Oct 7, 2020
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
While in full screen mode I have been able to change the caption and the file name to my liking but lastly I either need to change or eliminate the excel icon that only appears while in full screen mode in the upper left hand corner of the title bar. I have searched many threads and haven't found a clear answer to this. Any help is very appreciated.
 

Some videos you may like

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
3,849
.
You can try this :

VBA Code:
Option Explicit


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 SetStyleHide()

Dim lStyle As Long, hMenu As Long

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

hide_menu

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

Public Sub SetStyleShow()

Dim lStyle As Long, hMenu As Long

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

unhide_menu

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, True
SetBit lStyle, WS_SYSMENU, True
SetBit lStyle, WS_THICKFRAME, True
SetBit lStyle, WS_MINIMIZEBOX, True
SetBit lStyle, WS_MAXIMIZEBOX, True

'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

Sub hide_menu()


With Worksheets("Sheet1")


    With ActiveWindow
        .DisplayHorizontalScrollBar = False
        .DisplayVerticalScrollBar = False
    End With
    With Application
        .DisplayFullScreen = True
        .DisplayFormulaBar = False
        .DisplayStatusBar = False
    End With
    With Application
    
        .CommandBars("Full Screen").Visible = False
        .CommandBars("Worksheet Menu Bar").Enabled = False
        .CommandBars("Standard").Visible = False
        .CommandBars("Formatting").Visible = False
    End With
End With
End Sub


Sub unhide_menu()


With Worksheets("Sheet1")


    With ActiveWindow
        .DisplayHorizontalScrollBar = True
        .DisplayVerticalScrollBar = True
    End With
    With Application
        .DisplayFullScreen = False
        .DisplayFormulaBar = True
        .DisplayStatusBar = True
    End With
    With Application
        .CommandBars("Full Screen").Visible = True
        .CommandBars("Worksheet Menu Bar").Enabled = True
        .CommandBars("Standard").Visible = True
        .CommandBars("Formatting").Visible = True
    End With
End With
End Sub

Download workbook : How to remove the excel icon from the title bar in full screen mode.
 

ApricityMech

New Member
Joined
Oct 7, 2020
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
.
You can try this :

VBA Code:
Option Explicit


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 SetStyleHide()

Dim lStyle As Long, hMenu As Long

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

hide_menu

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

Public Sub SetStyleShow()

Dim lStyle As Long, hMenu As Long

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

unhide_menu

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, True
SetBit lStyle, WS_SYSMENU, True
SetBit lStyle, WS_THICKFRAME, True
SetBit lStyle, WS_MINIMIZEBOX, True
SetBit lStyle, WS_MAXIMIZEBOX, True

'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

Sub hide_menu()


With Worksheets("Sheet1")


    With ActiveWindow
        .DisplayHorizontalScrollBar = False
        .DisplayVerticalScrollBar = False
    End With
    With Application
        .DisplayFullScreen = True
        .DisplayFormulaBar = False
        .DisplayStatusBar = False
    End With
    With Application
   
        .CommandBars("Full Screen").Visible = False
        .CommandBars("Worksheet Menu Bar").Enabled = False
        .CommandBars("Standard").Visible = False
        .CommandBars("Formatting").Visible = False
    End With
End With
End Sub


Sub unhide_menu()


With Worksheets("Sheet1")


    With ActiveWindow
        .DisplayHorizontalScrollBar = True
        .DisplayVerticalScrollBar = True
    End With
    With Application
        .DisplayFullScreen = False
        .DisplayFormulaBar = True
        .DisplayStatusBar = True
    End With
    With Application
        .CommandBars("Full Screen").Visible = True
        .CommandBars("Worksheet Menu Bar").Enabled = True
        .CommandBars("Standard").Visible = True
        .CommandBars("Formatting").Visible = True
    End With
End With
End Sub

Download workbook : How to remove the excel icon from the title bar in full screen mode.

Logit unfortunately the above code did not work

Just be clear the picture below has the icon i would like to change or remove circled. This icon only appears while in full screen mode. I'm using excel 2016.

1602141007368.png
 

Attachments

  • 1602140891624.png
    1602140891624.png
    69.5 KB · Views: 4

ApricityMech

New Member
Joined
Oct 7, 2020
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
I just found this and it worked.. it successfully changed the excel icon to the notepad icon so now I can make my own favicon and adjust as needed. Thank you for your help.

'******CODE FOR THISWORKBOOK MODULE******

Option Explicit

Private Sub Workbook_Open()

Application.Caption = " My Personalized Workbook"

ChangeApplicationIcon

End Sub
'*****************************************

'************CODE FOR MODULE1*************

Option Explicit

Declare Function GetActiveWindow32 Lib "USER32" Alias _

"GetActiveWindow" () As Integer

Declare Function SendMessage32 Lib "USER32" Alias _

"SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _

ByVal wParam As Long, ByVal lParam As Long) As Long

Declare Function ExtractIcon32 Lib "SHELL32.DLL" Alias _

"ExtractIconA" (ByVal hInst As Long, _

ByVal lpszExeFileName As String, _

ByVal nIconIndex As Long) As Long

'modification of code from Excel Experts E-Letter Archives.

'Original code By Jim Rech can be found by following this

'link > Excel Templates [Free Download]

Sub ChangeApplicationIcon()

Dim Icon&

'*****Change Icon To Suit*******

Const NewIcon$ = "Notepad.exe"

'*****************************

Icon = ExtractIcon32(0, NewIcon, 0)

SendMessage32 GetActiveWindow32(), &H80, 1, Icon '< 1 = big Icon

SendMessage32 GetActiveWindow32(), &H80, 0, Icon '< 0 = small Icon
End Sub

'*****************************************
 

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
3,849
Hmm .... interesting that it works there for you. Nothing happens here.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,528
Messages
5,596,688
Members
414,087
Latest member
chewsters

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
Top