+ Reply to Thread
Results 1 to 4 of 4

Icons in TreeView Control

  1. #1
    Registered User
    Join Date
    04-04-2011
    Location
    Irvine, California
    MS-Off Ver
    Excel 2003
    Posts
    8

    Question Icons in TreeView Control

    I have a workbook that displays a form with a TreeView control. I'd like to assign various icons to different nodes in the tree. Based on the article at http://msdn.microsoft.com/en-us/libr...(v=VS.80).aspx, it appears that I need to read images from external files into an image list, which can then be referenced from the ImageIndex or IndexKey property of individual tree nodes.

    However, I also want my workbook to be portable, so I can E-mail it to someone and they can view it on their system and see the same things that I do. This doesn't seem consistent with the requirement to read in the icon files from a separate location, since in that case I need to distribute extra image files with the workbook and make sure they get installed in some known location.

    Is there some way of storing images with the Excel workbook itself and accessing them for use within a TreeView control on a form?

    Thanks.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Icons in TreeView Control

    Hello jfmorales,

    The link you referenced is for "VB.NET". Are you using VB.NET or VBA? They are two very different languages.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    04-04-2011
    Location
    Irvine, California
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Icons in TreeView Control

    >> The link you referenced is for "VB.NET". Are you using VB.NET or VBA? They are two very different languages. <<
    I meant VBA. When I do searches on the TreeView control, it often takes me accidentally to different versions for different languages. Thanks, Joseph

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Icons in TreeView Control

    Hello jfmorales,

    VBA can use icons in a Tree View control. You have to create an ImageList object that contains the pictures you want to display. The ImageList has a property ListImages that points to a ListImages collection object. This contains the ListImage pictures. The ListImage Picture property can be set to the picture you want by using the VBA LoadPicture method.

    The downside of this is you can not save the ImageList object as a resource file. If you want to use this on another computer then all the picture files have to be transferred also.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1