Results 1 to 6 of 6

Thread: Change the icon of an Excel file

  1. #1
    Join Date
    Feb 2008
    Posts
    2,180

    Change the icon of an Excel file

    I want to change the icon of a single excel file. I searched in the file properties but there is no change icon.

    The goal is to have different icons in relation to the types of Excel files for further clarity.

    The icons used are free, meaning that I can use what I draw

    If you have any info to help me I'm interested

  2. #2
    Join Date
    May 2008
    Posts
    518

    Re: Change the icon of an Excel file

    To my knowledge what you want to do is not feasible because the icon is linked to the type of file and not in his name.

    A possible solution, create a folder and add a shortcut for each file, then each shortcut will be individually adjustable.

  3. #3
    Join Date
    May 2008
    Posts
    979

    Re: Change the icon of an Excel file

    1 - Create a desktop shortcut to your file (Right Click/new/shortcut).

    2 - Right click on the shortcut then 'Properties' then 'change icon'

  4. #4
    Join Date
    Feb 2008
    Posts
    2,180

    Re: Change the icon of an Excel file

    the solution of the shortcut is not what I wanted (this is what I already use). It does not totally agree, is there any other solution

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: Change the icon of an Excel file

    You can test this procedure to place the module in the workbook "ThisWorkbook".

    Code:
    Option Explicit 
    
      Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ 
            (ByVal lpClassName As String, ByVal lpWindowName As String) As Long 
    
      Private Declare Function SendMessageA Lib "user32" _ 
            (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, _ 
            ByVal lParam As Long) As Long 
    
      Private Declare Function ExtractIconA Lib "shell32.dll" _ 
            (ByVal hInst As Long, ByVal lpszExeFileName As String, _ 
            ByVal nIconIndex As Long) As Long 
    
    
      Private Sub Workbook_Activate () 
          Dim File As String 
          Dim x As Long 
        
          'Path and filename of the icon to display 
          File = "C:\folder\myfile.ico" 
          'Check if file exists 
          If Dir (File) = "" Then Exit Sub 
        
          x = ExtractIconA (0, file, 0) 
          SendMessageA FindWindow (vbNullString, Application. Caption), _ 
              & H80, False, x 
    
      End Sub 
    
      Private Sub Workbook_Deactivate () 
          Dim File As String 
          Dim x As Long 
        
          File = Application. Path & "\excel.exe" 
          x = ExtractIconA (0, file, 0) 
          SendMessageA FindWindow (vbNullString, Application. Caption), _ 
              & H80, False, x 
    
      End Sub

  6. #6
    Join Date
    Oct 2010
    Posts
    1

    Re: Change the icon of an Excel file

    Hi everybody,
    I've been using this tempalte for a while and runs properly. However I've been asked to be a little bit more 'seasonal' in my excel files and suggest me to put a pumpkin icon & 'Happy Halloween' for example. I can uplaod an icon from internet put it in C:\WINDOWS\system32 and that's it. However when my friends will open the file it will work only if they also have the .ico file. Is there a way to self contain the picture into the excel file ? Something like refering to the picture paste somewhere on the excel file or keep in a UserForm in vba?
    Thansk for your answers.
    Don Pablo

Similar Threads

  1. Replies: 4
    Last Post: 19-02-2012, 04:58 PM
  2. How to change the icon of a .bat file in Windows 7?
    By Hima!! in forum Windows Software
    Replies: 6
    Last Post: 05-10-2011, 01:15 AM
  3. How to change icon or folder icon in Android
    By Tana$ya in forum Portable Devices
    Replies: 6
    Last Post: 06-07-2011, 10:35 AM
  4. How to Change Icon of the Batch File?
    By Segvoia in forum Operating Systems
    Replies: 3
    Last Post: 20-11-2009, 10:36 AM
  5. Replies: 4
    Last Post: 07-05-2009, 02:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,714,441.24605 seconds with 17 queries