Roger
asked on
How to replace Taskbar icon for Excel
Following the following API method:
http://stackoverflow.com/questions/20142765/how-to-change-the-excel-icon-in-taskbar-while-loading
I wrote the following, and called the setTaskBar_Icon procedure from ThisDocument.Workbook_Open ():
When I ran the sub with NewIco = ExtractIcon32(0, myIcoFile, index) with index set between 0 and 8
I got no error reports, and displayed NO change in the classic excel taskbar icon.
Please can you advise?
Option Explicit
Declare Function ExtractIcon32 Lib "shell32.dll" Alias _
"ExtractIconA" (ByVal hInst As Long, _
ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
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
Sub setTaskBar_Icon()
Dim myIcoFile As String
Dim NewIco
'~~> Change this to the relevant icon file
myIcoFile = "D:\aaThink_Build\Icons_Th ink\Cineri s_Document _Manager\C ineris_Doc _Manager_T askBar_xlI con.ico"
NewIco = ExtractIcon32(0, myIcoFile, 0) '<<<<<
SendMessage32 GetActiveWindow32(), &H80, 1, NewIco
MsgBox "Hello" 'to check the sub had run fully
End Sub
Source of Cineris_Doc_Manager_TaskBa r_xlIcon.i co
.ICO FILE: this file type does not load into EE site, so I changed the extension. If you down load it, please change it back to .ico
Thanks
Kelvin
Cineris-Doc-Manager-TaskBar-xlIcon---Cop
http://stackoverflow.com/questions/20142765/how-to-change-the-excel-icon-in-taskbar-while-loading
I wrote the following, and called the setTaskBar_Icon procedure from ThisDocument.Workbook_Open
When I ran the sub with NewIco = ExtractIcon32(0, myIcoFile, index) with index set between 0 and 8
I got no error reports, and displayed NO change in the classic excel taskbar icon.
Please can you advise?
Option Explicit
Declare Function ExtractIcon32 Lib "shell32.dll" Alias _
"ExtractIconA" (ByVal hInst As Long, _
ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
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
Sub setTaskBar_Icon()
Dim myIcoFile As String
Dim NewIco
'~~> Change this to the relevant icon file
myIcoFile = "D:\aaThink_Build\Icons_Th
NewIco = ExtractIcon32(0, myIcoFile, 0) '<<<<<
SendMessage32 GetActiveWindow32(), &H80, 1, NewIco
MsgBox "Hello" 'to check the sub had run fully
End Sub
Source of Cineris_Doc_Manager_TaskBa
.ICO FILE: this file type does not load into EE site, so I changed the extension. If you down load it, please change it back to .ico
Thanks
Kelvin
Cineris-Doc-Manager-TaskBar-xlIcon---Cop
It works for me as advertised, with Win7 and XL2007. What versions are you running?
Also, there is only one icon in that ICO file. So any value other that 0 will return nothing.
ASKER
Thanks:
I use excel 2010 and windows 7
When I downloaded the mislabelled ico file and replaced the file name with Cineris-Doc-Manager-TaskBa r-xlIcon.i co, and opened in Windows photo viewer I got 8 pages with different icons.
I'm new to icon files, can you tell me: what am I doing wrong?
Kelvin
I use excel 2010 and windows 7
When I downloaded the mislabelled ico file and replaced the file name with Cineris-Doc-Manager-TaskBa
I'm new to icon files, can you tell me: what am I doing wrong?
Kelvin
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for Kelvin4's comment #a40882032
for the following reason:
Many thanks,
I checked the attached graphics file, by downloading it and changing its name to:
Cineris_Doc_Manager_TaskBa r_xlIcon.i co (this name being represented as a string by myIcoFile)
I confirm your observation that NewIco = ExtractIcon32(0, myIcoFile, -1) returns a value of 1
I confirm my observation that when Cineris_Doc_Manager_TaskBa r_xlIcon.i co is opened in Windows photo viewer I got 8 pages with different icons.
I have written for guidance to IcoFx (who make the Icon graphics package).
Many thanks for helping me forward.
Kelvin
Accepted answer: 0 points for Kelvin4's comment #a40882032
for the following reason:
Many thanks,
I checked the attached graphics file, by downloading it and changing its name to:
Cineris_Doc_Manager_TaskBa
I confirm your observation that NewIco = ExtractIcon32(0, myIcoFile, -1) returns a value of 1
I confirm my observation that when Cineris_Doc_Manager_TaskBa
I have written for guidance to IcoFx (who make the Icon graphics package).
Many thanks for helping me forward.
Kelvin
ASKER
OBJECTION ......... by Kelvin
Total embarrassment!!
I did NOT intend to Claim points for myself!!!!
Please credit Wayne Taylor (webtubbs) with all 500 points.
Abjectly,
Kelvin
Total embarrassment!!
I did NOT intend to Claim points for myself!!!!
Please credit Wayne Taylor (webtubbs) with all 500 points.
Abjectly,
Kelvin
ASKER
Thanks, now I can get my points to you!