LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Treeview on a sheet

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TreeView Stephen[_22_] Excel Programming 2 October 10th 05 06:25 PM
Treeview Patrick Choi[_2_] Excel Programming 1 September 6th 04 08:29 AM
How to Treeview in VBA kvenku[_9_] Excel Programming 1 May 27th 04 01:03 PM
TreeView marijan glavac[_2_] Excel Programming 2 April 30th 04 07:28 AM
Treeview Max Scott Excel Programming 2 October 3rd 03 02:00 PM


All times are GMT +1. The time now is 01:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"