Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you change the XL menubar icon?

Status
Not open for further replies.

GVF

Programmer
Feb 25, 2005
160
US
I can change the Excel Application icon. I would like to further customize by changing the standard XL icon that appears at the left end of my custom menubar. If it changes the icon on all menubars then that's OK too.

1. Can the menubar icon be changed?
2. If so - how do I do dat?
 
This may work:
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


Cogito eggo sum – I think, therefore I am a waffle.
 
Thanks for the try genomon but that code changes the Application icon at the left end of the title bar (I have that one taken care of).

The last bit of customization I want to perform is to add my own icon to my custom menubar. The same Excel icon that is at the left end of the Worksheet Menu Bar (to the left of "File") also appears on my custom menu bar. That's where I want the next custom icon.
 
When there is no workbook open the icon is not there.

So it's the "Workbook Icon"
I want to change.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top