Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TreeView Color Problem 1

Status
Not open for further replies.

TopJack

Programmer
Mar 10, 2001
153
GB
Im using Excel 2003 for a userform that has a MS TreeView (V6) on it. I want to color certain nodes to create differences between them.

I believe there is a Backcolor and Forecolor option but I can't get them to work on the nodes. All I get is a complete blackout of the node no matter what color I set.

Any clues would be great.

Here is some of my code so far as a reference -

Code:
Sub setup_tree()
Dim nodeitem As Node

'create tree levels
With UserForm1.TreeView1
    .Nodes.Clear    'clear all previously loaded nodes
    Set nodeitem = .Nodes.Add(, , "Top", "This is the top level")   'add the very top level
    nodeitem.Expanded = True    'expand tree level
    
    Set nodeitem = .Nodes.Add("Top", tvwChild, "Level 2", "Level 2")  'add child to top level
    nodeitem.BackColor = red    'color node background in red (not working!!)
    nodeitem.ForeColor = blue   'color node foreground in red (not working!!)
End With

'show form to user
Load UserForm1
UserForm1.Show

End Sub
 
Hi,

once again Skip has delivered. It worked a treat. Thanks a lot.

Sometimes you can't see the wood for the trees.

Cheers.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top