+ Reply to Thread
Results 1 to 2 of 2

How do you populate imagelist with shape from worksheet?

  1. #1
    Registered User
    Join Date
    08-26-2014
    Location
    sdcds
    MS-Off Ver
    2013
    Posts
    1

    How do you populate imagelist with shape from worksheet?

    I wish to create a Treeview with images and data from a worksheet (each line has the name of a part, its next up assembly and an icon all populated by the user). I've finally managed to get the treeview to populate correctly and to include images from an external source (based on code from various sources and just a little of my own).
    Setting up the Imagelist and assigning it to the Treeview is still a mystery to me but it works.

    What is missing is getting the pictures from inside the worksheet and into the Imagelist instead of from an outside source ((using iml.ListImages.Add 1, "img1", LoadPicture("C:\Temp\red.jpg") ).
    I read dozens of posts about it to no avail, and there is one that is mentioned in several places but is a deadend. The one other alternative I've read about involves copying the picture to the clipboard and pasting elsewhere but it involves a lot of code and seemed beyond my capability, so I haven't tried it yet.

    I can "read" the pictures properties from the worksheet using Sheet1.Shapes(1) or similar with .Type (which results in "13") or .Name (which returns "Picture 1" for example) or .TopLeftCell.Address (which returns "$C$1" for example) etc. So I know I have access to them and am referencing the correct objects.
    When I try to use iml.ListImages.Add 1, "img1", Sheet1.Shapes(1) I get a "Invalid Picture" error.
    When I try to use iml.ListImages.Add 1, "img1", Sheet1.Shapes(1).Picture I get a "Object doesn't support this property or method" error.
    When I try to use iml.ListImages.Add 1, "img1", Sheet1.Shapes(1).CopyPicture I get a "Type Mismatch" error.

    I don't know what else to try and where else to look. Please help.

    EDIT: This all happens in a userform.
    Last edited by ppmendonca; 08-28-2014 at 07:29 AM.

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: How do you populate imagelist with shape from worksheet?

    Please Login or Register  to view this content.
    You'd think that it would be that easy, but unfortunately, you still have to use the external file to display it. You have to export the shape like a chart, display it on the userform, then delete the temp file when you're through.
    David
    (*) Reputation points appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Control Tip for Shape in worksheet
    By surajitbose in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2014, 10:14 AM
  2. Populate Shape with Cell value until user defined limit reached
    By mother in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2014, 01:09 PM
  3. Add Shape in Protected Worksheet
    By ct11 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2009, 10:15 AM
  4. Shape/picture name in a worksheet
    By neta in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-29-2006, 11:00 AM
  5. [SOLVED] when setting Imagelist for ImageCombot, Excel crash
    By Arnaud in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2005, 02:50 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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1