Excel Icon

brepsenkamp

Board Regular
Joined
May 13, 2002
Messages
90
Hi,

I have created my own application in Excel,
without any toolbars and my own commandbar(1).
Now I have at the left of this commandbar an excel icon. I don't like that at all.
How to make this invisible?

Regards,

Robert
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
To get rid of the title bar use:
Application.DisplayFullScreen = True
If this will not do then you will likely need to do some programming with the API.
Tom
 
Upvote 0
Tom,

I want to have the titlebar.
I have created a new Commandbar, so the standard commandbar is replaced with this one.
On the new commandbar is an excel icon placed left to the first pop-up menu.
I just think I have to change my code that makes the new commandbar. But what to do?

Thanks for your help
 
Upvote 0
Rather than replace the existing Menu bar with yours create a new one and disable the old one.

Code:
Sub Test()
    Dim NewBar As CommandBar
    Set NewBar = CommandBars.Add(Position:=msoBarTop, MenuBar:=False)
    With NewBar
        .Name = "MyBar"
        .Visible = True
    End With
'   *** replace next line with the code that adds your controls ***
    CommandBars("Worksheet Menu Bar").Controls(1).Copy Bar:=CommandBars("MyBar")
    CommandBars("Worksheet Menu Bar").Enabled = False
End Sub

The key is setting the MenuBar argument of the Add method to False (the default). Then there is no Excel icon.
 
Upvote 0
Brepsenkamp,

Some time ago XL-Dennis posted code (I believe his source was unknown) that will change the default excel icon to any icon of your choosing (*.ico).

Searching the title: "Changing the excel icon" will take you to the thread, but the content of Xl-Dennis's post is no longer there.

You might try e-mailing Xl_Dennis and see if he would consider posting that code again.

good luck

mweaver
 
Upvote 0
This code will change the Excel icon to whatever you specify....Hope it helps.

Code:
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long
Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long

Const WM_SETICON = &H80

Sub SetExcelIcon()
Dim lngXLHwnd As Long, lngIcon As Long, strIconPath As String


'Change this to a valid icon path on your network/drive
strIconPath = "C:Program FilesMicrosoft Visual StudioCommonGraphicsIconsFlagsFLGUK.ICO"
lngXLHwnd = FindWindow("XLMAIN", Application.Caption)

lngIcon = ExtractIcon(0, strIconPath, 0)

SendMessage lngXLHwnd, WM_SETICON, False, lngIcon

End Sub
 
Upvote 0
Hi,

<pre>
Option Explicit

Private Declare Function ExtractIcon Lib "shell32.dll" _
Alias "ExtractIconA" ( _
ByVal hInst As Long, _
ByVal lpszExeFileName As String, _
ByVal nIconIndex As Long) As Long

Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Integer, _
ByVal lParam As Long) As Long

Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long

Private Const WM_SETICON = &H80
Private Const ICON_SMALL = 0
Private Const ICON_BIG = 1

Sub setExcelIcon(Optional stFileName As String = "", Optional strIconIndex _
As Long = 0, Optional bSetBigIcon As Boolean = False, Optional bSetSmallIcon _
As Boolean = True)
'© 2002 Alla rättigheter Stephen Bullen

Dim hIcon As Long
Dim hwndXLApp As Long

On Error Resume Next
hwndXLApp = FindWindow("XLMAIN", Application.Caption)

If hwndXLApp <> 0 Then
Err.Clear
If stFileName = "" Then
strIconIndex = 8000
hIcon = ExtractIcon(0, Application.Path & Application.PathSeparator & "Excel.exe", strIconIndex)
ElseIf Dir(stFileName) = "" Then
hIcon = 0
ElseIf Err.Number <> 0 Then
hIcon = 0
Else
hIcon = ExtractIcon(0, stFileName, strIconIndex)
End If

If bSetBigIcon Then SendMessage hwndXLApp, WM_SETICON, ICON_BIG, hIcon
'Ändra ikon i MS Excel.
If bSetSmallIcon Then SendMessage hwndXLApp, WM_SETICON, ICON_SMALL, hIcon
End If

End Sub

Sub Change_Icons()
setExcelIcon "E:OfficeIkonerstaroffice.ico"
End Sub

Sub Reset_Icons()
setExcelIcon ""
End Sub
</pre>

Warm regards from a cold Östersund,

Dennis
 
Upvote 0
Hi Dennis,

Is there a way that I can modify the above so that the ICON which appears when you press ALT + TAB is also changed.

Any help would be greatly appreciated.

Thanks

Mark
 
Upvote 0

Forum statistics

Threads
1,216,106
Messages
6,128,863
Members
449,473
Latest member
soumyahalder4

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