galileo
07-07-2009, 02:45 AM
Hey guys!
I use WITH to add elements to a treeView object. Now I'd like to add pictures to some nodes but do not get a working result... Might just be a small referencing problem!? Below find the working code to add a node (top level)
Situation:
Excel 2007, VBA
Userform with TreeView (MSCOMctl) -> "TreeView1"
ImageList -> "Ircon" with picture IDs 1-5
'**********************************************************
' Add node at last position
Function add_node(...) As Integer
With Me.TreeView1.Nodes
objTreeView1.ImageList = Me!Ircon.Object
Select Case node_type
'Add Node: Parent level
Case Is = 1
.Add Key:="Node" & Key, Text:=node_content
.Image = 1 'Not working (!!)
End Select
End With
End Function
Thanks,
André
I use WITH to add elements to a treeView object. Now I'd like to add pictures to some nodes but do not get a working result... Might just be a small referencing problem!? Below find the working code to add a node (top level)
Situation:
Excel 2007, VBA
Userform with TreeView (MSCOMctl) -> "TreeView1"
ImageList -> "Ircon" with picture IDs 1-5
'**********************************************************
' Add node at last position
Function add_node(...) As Integer
With Me.TreeView1.Nodes
objTreeView1.ImageList = Me!Ircon.Object
Select Case node_type
'Add Node: Parent level
Case Is = 1
.Add Key:="Node" & Key, Text:=node_content
.Image = 1 'Not working (!!)
End Select
End With
End Function
Thanks,
André