Iterate thru treeview control

  • Thread starter Thread starter Dale Fye
  • Start date Start date
D

Dale Fye

I have a command button on a form that contains a treeview
control. When I click the command button, I want to
iterate thru the treeview and identify all of the nodes
and leaves that are checked.

I've tried the following but get a "Type mismatch" error
on the line indicate with <<

Dim tv as MSComctllib.treeview
Dim nd as Node

set X as Me.MyTree <<
For each nd in X.nodes
if nd.checked then debug.print nd.key
next
 
You haven't dim'd X in your code and you haven't used tv.
Is it a typo?

Hope This Helps
Gerald Stanley MCSD
 
Typo. Here is what I meant to put.

Dim tv as MSComctllib.treeview
Dim nd as Node

set tv as Me.MyTree <<
For each nd in tv.nodes
if nd.checked then debug.print nd.key
next
 
Set tv as Me.MyTree. Is it a typo
It should be Set tv = Me.MyTree

Hope This Helps
Gerald Stanley MCSD
 
Back
Top