Consulting

Results 1 to 9 of 9

Thread: Sleeper: Change excel icon

  1. #1
    VBAX Expert
    Joined
    Jan 2005
    Posts
    574
    Location

    Sleeper: Change excel icon

    Is it possible to change the desktop icon for just one excel workbook to my own image and leave all others with the standard excel icon?

  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    If you make it a shortcut to your workbook you can change the icon in the shortcut properties
    K :-)

  3. #3
    VBAX Expert
    Joined
    Jan 2005
    Posts
    574
    Location
    wont work for what im looking to do, i need to change just the one icon if that is possible

  4. #4
    VBAX Mentor Brandtrock's Avatar
    Joined
    Jun 2004
    Location
    Titonka, IA
    Posts
    399
    Location
    Check out Colo's solution here: Colo's Junk Room

    Check out Daniell Klann's solution here: Daniel Klann.com

    HTH
    Brandtrock




  5. #5
    Administrator
    VP-Knowledge Base
    VBAX Master
    Joined
    Jan 2005
    Location
    Porto Alegre - RS - Brasil
    Posts
    1,219
    Location
    I have copied it here for you!

    1. Add an image control on the worksheet. (In this example, the image control is placed in the Sheet1)
    You can add image controls View - Toolbars - Control Toolbox from main menu bar.

    2. Right click for Propertiesof the image control and select appropriate ico file(with an extension of .ico) from picture property box in the properties window.
    Now you can see the picture on the Sheet1 as follows.

    3.Place the following in the standard module.

    Note: Some kind of ico image doesn't work. I am not sure about the reason.
    Option Explicit Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, _ ByVal lpWindowName As String) _ As Long Declare Function SendMessage Lib "user32" _ Alias "SendMessageA" _ (ByVal hWnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ lParam As Any) As Long Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long Const WM_SETICON = &H80 Const ICON_SMALL = 0& Const ICON_BIG = 1& Sub ChangingExcelIcon() MsgBox "Change Excel Icon" Call ChangeXLIcon(Sheet1.Image1.Picture.Handle) End Sub Sub MakeExcelIconDefaultAgain() MsgBox "Make Excel Icon default again" Call ChangeXLIcon End Sub Private Sub ChangeXLIcon(Optional ByVal hIcon As Long = 0&) Dim hWnd As Long Dim lngRet As Long 'Get the handle of Excel application hWnd = FindWindow("XLMAIN", Application.Caption) lngRet = SendMessage(hWnd, WM_SETICON, ICON_SMALL, ByVal hIcon) lngRet = SendMessage(hWnd, WM_SETICON, ICON_BIG, ByVal hIcon) lngRet = DrawMenuBar(hWnd) End Sub
    Best Regards,

    Carlos Paleo.

    To every problem there is a solution, even if I dont know it, so this posting is provided "AS IS" with no warranties.

    If Debugging is harder than writing a program and your code is as good as you can possibly make
    it, then by definition you're not smart enough to debug it.




    http://www.mugrs.org

  6. #6
    VBAX Expert
    Joined
    Jan 2005
    Posts
    574
    Location
    thank you for your help but what im after is changing the excel icon that appears on your desktop ( Or anywhere else) for just that one instance of excel if that is possible

  7. #7
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    • Create a shortcut to the file

    • Right click the shortcut

    • Properties

    • Change Icon...

  8. #8
    VBAX Mentor Brandtrock's Avatar
    Joined
    Jun 2004
    Location
    Titonka, IA
    Posts
    399
    Location
    Quote Originally Posted by gibbo1715
    thank you for your help but what im after is changing the excel icon that appears on your desktop ( Or anywhere else) for just that one instance of excel if that is possible
    Quote Originally Posted by DRJ
    • Create a shortcut to the file

    • Right click the shortcut

    • Properties

    • Change Icon...

    When someone wearing Killian's clothes and bearing a striking resemblance to Killian suggested the same approach that Jake has just posted in reply to your post, you said it wouldn't work for your situation. Sorry that I interpreted that to mean the icon in the window.

    Paleo, Thanks for including the info from Colo's page.

    Anyhow, hope this helps someone.

    Regards,
    Brandtrock




  9. #9
    Administrator
    VP-Knowledge Base VBAX Master
    Joined
    Jan 2005
    Location
    Porto Alegre - RS - Brasil
    Posts
    1,219
    Location
    Hi gibbo1715,

    is it solved??
    Best Regards,

    Carlos Paleo.

    To every problem there is a solution, even if I dont know it, so this posting is provided "AS IS" with no warranties.

    If Debugging is harder than writing a program and your code is as good as you can possibly make
    it, then by definition you're not smart enough to debug it.




    http://www.mugrs.org

Posting Permissions

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