Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for that, but it's not working for me. I had to change the code anyway
as I don't have the option of storing the images externally, so using LoadPicture is not possible in this case unfortunately. The images are stored on one sheet and the code I'm uising ATM is this: sub BuildImageList() Dim i As Integer Dim ws As Worksheet Dim arrObjName Set ws = ThisWorkbook.Sheets("Sheet2") ws.Visible = xlSheetVisible arrObjName = ws.Range("AE10:AE13").Value ws.OLEObjects("TreeviewImages").Object.ListImages. Clear For i = 1 To 4 ws.OLEObjects("TreeviewImages").Object.ListImages. Add Key:="img" & i, Pictu=ws.OLEObjects("Image" & i).Object.Picture Next Set ThisWorkbook.Sheets("Sheet1").tvContents.ImageList = ThisWorkbook.Sheets("Sheet1").TreeviewImages Set ws = Nothing End Sub I used your syntax when it came to assigning the image list, but it came back with the 'object does not support property or method' error. "michelxld" wrote: Hello Patrick i hope this helps you Dim k As Byte, j As Byte Dim Img1 As String, Img2 As String Sheets(1).ImageList1.ListImages.Clear Sheets(1).TreeView1.Nodes.Clear Img1 = ThisWorkbook.Path & "\LeChat.bmp" Img2 = ThisWorkbook.Path & "\2053851.jpg" Sheets(1).ImageList1.ListImages.Add 1, "Image1", LoadPicture(Img1) Sheets(1).ImageList1.ListImages.Add 2, "Image2", LoadPicture(Img2) Set Sheets(1).TreeView1.ImageList = Sheets(1).ImageList1 For k = 1 To 5 Sheets(1).TreeView1.Nodes.Add , , "maClé1" & k, "ParentNode" & k, "Image1", "Image2" Next For j = 1 To 5 For k = Sheets(1).TreeView1.Nodes.Count To Sheets(1).TreeView1.Nodes.Count + 2 Sheets(1).TreeView1.Nodes.Add "maClé1" & j, tvwChild, "maClé2" & Str(k), _ "ChildNode" & k, "Image1", "Image2" Next Next regards michel -- michelxld ------------------------------------------------------------------------ michelxld's Profile: http://www.excelforum.com/member.php...o&userid=17367 View this thread: http://www.excelforum.com/showthread...hreadid=538037 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
TreeView | Excel Programming | |||
Treeview | Excel Programming | |||
How to Treeview in VBA | Excel Programming | |||
TreeView | Excel Programming | |||
Treeview | Excel Programming |