ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Treeview/imagelist problem (https://www.excelbanter.com/excel-programming/303634-treeview-imagelist-problem.html)

ravi_cpt

Treeview/imagelist problem
 
hi,

i have a EXCEL template file which loads a VBA dialog containing
TREEVIEW control and IMAGELIST.

i use the following code

Private Sub UserForm_Initialize()

ImageList1.ListImages.Add 1, , LoadPicture("e:\sclose.ico")
ImageList1.ListImages.Add 2, , LoadPicture("e:\sopen.ico")

Set TreeView1.ImageList = ImageList1

With TreeView1
.Nodes.Clear
.Nodes.Add , , "Root", "Venku", LoadPicture("e:\sclose.ico")
LoadPicture("e:\sopen.ico")
.Nodes.Add "Root", tvwChild, "XX", "Shruthik"
.Nodes.Add , , "Root1", "Mouna"
End With
End Sub

but i am getting an error :
Invalid Object while @ Set TreeView1.ImageList = ImageList1

can anybody suggest me whats wrong with this code.

thanks
-ravi

Attachment filename: book1.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=61292
--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 09:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com