ExcelBanter

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

Patrick Choi[_2_]

Treeview
 
I have a treeview (version 6.0) embedded in a worksheet. After I add a node
to the structure, I wish I could have the newly added treenode highlighted
straight away so that the user could edit the label instantly, like what one
can do with Microsoft Outlook, say adding a new folder. Is there a way doing
so? Pls point me to the right direction. Thanks a lot.



Harald Staff

Treeview
 
Hi

See if something like this works for you:

Private Sub Btn1_Click()
Dim Nodx As Node
Set Nodx = Me.Tvw1.Nodes.Add("Root", _
tvwChild, "N" & Tvw1.Nodes.Count + 1, "New node")
Nodx.EnsureVisible
Nodx.Selected = True
Tvw1.LabelEdit = tvwAutomatic
Tvw1.StartLabelEdit
Set Nodx = Nothing
End Sub

(I wrote this with VB6. Maybe the objects will need a different addressing
from Excel, but you obviously know how to do that part.)

HTH. Best wishes Harald


"Patrick Choi" skrev i melding
...
I have a treeview (version 6.0) embedded in a worksheet. After I add a

node
to the structure, I wish I could have the newly added treenode highlighted
straight away so that the user could edit the label instantly, like what

one
can do with Microsoft Outlook, say adding a new folder. Is there a way

doing
so? Pls point me to the right direction. Thanks a lot.






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

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