Change .xls file icon

jgoulart

Board Regular
Joined
Feb 16, 2002
Messages
62
Is it possible to change the icon of an excel .xls file? If so how would I go about doing this. Is this something that can be done with maunually without vba or only in vba or not at all?

John
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
im not 100% sure, but i would think this is a windows thing. it uses the icon for the program it is associated with. so if you told windows to open .xls files with wordpad, they would have wordpad icons. Im not sure if it is possible to change them. You can change the shortcuts to them however!
 
Upvote 0
Yes you can change the icon

try this simplified version;
Note it gets the icons from the more icons dll
BUT you can get it from anyprogram....

'This code shows you how to change the Excel icon:

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

Dim hdlNewIcon As Long
Dim hdlXlMain As Long

Sub ChangeXLIcon()

hdlNewIcon = ExtractIcon32(0, "C:WINDOWSMoricons.dll", 1)
hdlXlMain = GetActiveWindow32()

SendMessage32 hdlXlMain, &H80, 1, hdlNewIcon 'Icon big

End Sub

Sub RestoreXLIcon()

hdlNewIcon = ExtractIcon32(0, "C:Program FilesMicrosoft OfficeOfficeexel.exe", 1)
hdlXlMain = GetActiveWindow32()

SendMessage32 hdlXlMain, &H80, 1, hdlNewIcon 'Icon big

End Sub



HTH

Ivan
 
Upvote 0
Right click on the icon
Select Properties
Click on the Change icon button.
Browse to find a suitable icon
There are lots in moreicon.dll
You can get programs to create your own.
Try searching TUCOWS
 
Upvote 0
Won't all these procedures make every single .xls file have that icon? That has been my experience in the past.

If the goal is to only change the icon of one file, then this is a problem.
 
Upvote 0
On 2002-03-14 09:06, DMeador52 wrote:
Won't all these procedures make every single .xls file have that icon? That has been my experience in the past.

If the goal is to only change the icon of one file, then this is a problem.

No....the code I gave will only be in effect for as long as the excel session runs...
clsoing excel down resets back to original
Where as the manual method will not.


Ivan
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,243
Members
448,555
Latest member
RobertJones1986

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