ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   can this be done? (https://www.excelbanter.com/excel-programming/424711-can-done.html)

michael.beckinsale

can this be done?
 
Hi All,

I am dynamically creating a treeview on a userform from a table where
the leftmost column is the main node & the subsequent columns denote
the relationships. The final column is the account code and disabled
accounts are in red text. For various reasons the disabled accounts
need to be in the hierachy / treeview.

My code successfuly builds the treeview but l cannot find any
information on how to change the colour of specific nodes.

Another thought was to use the 'strikthrough' property to denote a
disabled account but whilst l could get this to work on the whole
treeview l could not get it to work on specific nodes.

I have spent a couple of days on this and l am getting nowhere. Very
frustrated!

Here are a couple of code snippets l have tried.

Any help code pointers etc greatly appreciated.

For Each branch In Userform1.TreeView1.Nodes
If branch.Key = "Disabled" Then
branch.Font.Forecolor = "&H000000F&" 'object does not support this
method / property
branch.Font.Strikethrough = True 'object does not support this
method / property
..Font.Strikethrough = True 'effects whole tree
Next

Regards

Michael

Nigel[_2_]

can this be done?
 
I do not think you can control colors at branch level, but how about adding
images?

see this link for example.. http://puremis.net/excel/code/080.shtml


--

Regards,
Nigel




"michael.beckinsale" wrote in message
...
Hi All,

I am dynamically creating a treeview on a userform from a table where
the leftmost column is the main node & the subsequent columns denote
the relationships. The final column is the account code and disabled
accounts are in red text. For various reasons the disabled accounts
need to be in the hierachy / treeview.

My code successfuly builds the treeview but l cannot find any
information on how to change the colour of specific nodes.

Another thought was to use the 'strikthrough' property to denote a
disabled account but whilst l could get this to work on the whole
treeview l could not get it to work on specific nodes.

I have spent a couple of days on this and l am getting nowhere. Very
frustrated!

Here are a couple of code snippets l have tried.

Any help code pointers etc greatly appreciated.

For Each branch In Userform1.TreeView1.Nodes
If branch.Key = "Disabled" Then
branch.Font.Forecolor = "&H000000F&" 'object does not support this
method / property
branch.Font.Strikethrough = True 'object does not support this
method / property
.Font.Strikethrough = True 'effects whole tree
Next

Regards

Michael




All times are GMT +1. The time now is 10:03 PM.

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