Iterate thru treeview control

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
 
G

Gerald Stanley

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
 
D

Dale Fye

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
 
G

Gerald Stanley

Set tv as Me.MyTree. Is it a typo
It should be Set tv = Me.MyTree

Hope This Helps
Gerald Stanley MCSD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top