How can I change xls file icons?

G

GS

Paul in Houston TX pretended :
How can I change xls file icons?
Excel 2003, Windows 7

If you are trying to 'hide' xls files so they don't show up in Windows
Explorer or browse dialogs as Excel file, just change the extension to
something that refs to your project name. Note that file extensions can
be longer than 3 characters.
 
M

Michael Bednarek

How can I change xls file icons?
Excel 2003, Windows 7

Have you tried changing the relevant entry in the registry?

Find HKEY_CLASSES_ROOT\.xls ; note its "(Default)" value (here, it's
Excel.Sheet.8 ). Find that key (HKEY_CLASSES_ROOT\Excel.Sheet.8) and the
key DefaultIcon below that; note its value (here:
C:\WINDOWS\Installer\{90110409-6000-11D3-8CFE-0150048383C9}\xlicons.exe,1);
change it.
 
P

Paul in Houston TX

Michael said:
Have you tried changing the relevant entry in the registry?

Find HKEY_CLASSES_ROOT\.xls ; note its "(Default)" value (here, it's
Excel.Sheet.8 ). Find that key (HKEY_CLASSES_ROOT\Excel.Sheet.8) and the
key DefaultIcon below that; note its value (here:
C:\WINDOWS\Installer\{90110409-6000-11D3-8CFE-0150048383C9}\xlicons.exe,1);
change it.
Thanks! I had tried that last week to no avail.
Used ResHacker to view the icons in xlicons.exe.
It turns out that I had to add the UserChoice key to
the registry, also, or it would not take.
It seems to be working now. :)
 
D

Don Guillett

Thanks!  I had tried that last week to no avail.
Used ResHacker to view the icons in xlicons.exe.
It turns out that I had to add the UserChoice key to
the registry, also, or it would not take.
It seems to be working now.  :)

I have not checked this buy you may?? be violating your user agreement.
 
G

GS

I have not checked this buy you may?? be violating your user agreement.

I believe you are correct as the target keys are part of MSO's
installed structure, and is covered by the rather lengthy EULA (which
nobody ever bothers to actually read during install<g>). That's why I
simply change the file extensions of project files when/if desired!
 
I

isabelle

hi Paul,

Option Explicit

Const FichierIco As String = "Logo.ico"

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

Private Declare Function GetClassLongA Lib "user32" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long

Private Declare Function SetClassLongA Lib "user32" _
(ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Declare Function LoadImageA Lib "user32" _
(ByVal hInst As Long, ByVal lpsz As String, ByVal un1 As Long, _
ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long


Dim HIcon As Long, hWnd As Long


Sub Restore_Ico()
If HIcon Then SetClassLongA hWnd, -14, HIcon
End Sub

Sub Modify_Ico()
Dim FIcone As String

' Adapt the file path
FIcone = "C:\Documents and Settings\Administrateur\Mes documents\alarme.ico"

If Dir$(FIcone) <> "" Then
hWnd = FindWindowA(vbNullString, Application.Caption)
HIcon = GetClassLongA(hWnd, -14)
SetClassLongA hWnd, -14, LoadImageA(0, FIcone, 1, 0, 0, &H10)
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top