Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    TreeView on Userform (VBA (any))

    Does anyone have some sample code for populating a treeview and/or an imagelist control on a Userform. My treeview is a list of object names which I can create, but I also want to add an image to each node: a small square which is the same color as the object. For example, I might have a Fruit node which has apples and bananas as children. I want to create a small square at run-time which is colored red for the apple image and yellow for the banana image. I need to create the images at run-time because the user can color the objects with any RGB color before displaying the userform. TIA --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  2. #2
    New Lounger
    Join Date
    Jul 2002
    Location
    Auckland, New Zealand
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: TreeView on Userform (VBA (any))

    Have a look here @ Colo's example

    http://puremis.net/excel/code/080.shtml

    (Above URL made clickable by HansV)

  3. #3
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: TreeView on Userform (VBA (any))

    Sammy

    I found this article "Making the Most of the VB TreeView Control" to be very informative. Don't recall if it deals with graphics though, but certainly deals with runtime population.

    Alan

  4. #4
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: TreeView on Userform (VBA (any))

    Thanks Ivan & Alan, these are very nice code examples that I hadn't found. Colo's example looks like my solution, but I have a color column instead of an image column, so I have to create the images at run-time. I'll try to remember to post my code, but right now it is not on this network. Thanks! --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

Posting Permissions

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