Change .xls file icon
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: Change .xls file icon

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    John G
    Posts
    62
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    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

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Location
    Stockton, California
    Posts
    281
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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!

  3. #3
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

  5. #5
    New Member
    Join Date
    Mar 2002
    Posts
    32
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.

  6. #6
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    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

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com