LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Why doesn't this function return TRUE?

Hi RBS,

For one thing:

Instead of
Call CheckMissingTicks(nodChild, intDepth + 1)
put
CheckMissingTicks=CheckMissingTicks(nodChild, intDepth +
1)

Don't know if it solves all your problems.

Regards,

Daniel M.

"RB Smissaert" wrote in message
...
Using Excel XP.
Made a function (from an example pointed out by Tom Ogilvy) that checks

for
missing ticked checkboxes in a Treeview.
It should return TRUE if a particular node is found (with a particular
image) and no ticks have been found yet.
The function does work when I check it with a messagebox, but it still
returns FALSE when it should be TRUE.
This is the function:

Function CheckMissingTicks(ByRef nodCurrent As Node, _
ByVal intDepth As Integer) As Boolean

Dim nodChild As Node
Dim HasTick As Boolean

If nodCurrent.Children 0 Then
For Each nodChild In MainForm.TreeView1.Nodes
If Not nodChild.Parent Is Nothing Then
If nodChild.Parent Is nodCurrent Then

If nodChild.Checked = True And _
Not nodChild.Image = 9 Then
HasTick = True
End If

If HasTick = False And _
nodChild.Image = 9 Then
'collection node, but no tick found yet
CheckMissingTicks = True
Exit Function
End If

Call CheckMissingTicks(nodChild, intDepth + 1)
End If
End If
Next nodChild
End If

End Function


And this is how the function is called:

If CheckMissingTicks(TreeView1.Nodes(1), 0) = True Then .............


I solved it for now by declaring a variable that will be true if the
particular conditions are met and checking for this variable, but I am

just
puzzled by what is wrong here. Most likely I am overlooking something

really
simple and somebody could help me out easily.


RBS




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to return a number instead of true/false with an if function? charles New Users to Excel 3 October 1st 09 07:50 AM
Search for 2 true arguments and return true or false David Excel Discussion (Misc queries) 3 July 15th 06 10:18 AM
How do I make the true return a drop down list in the IF function? Brian Excel Worksheet Functions 5 April 13th 06 09:40 PM
Function to return True/False if all are validated as True by ISNU Tetsuya Oguma Excel Worksheet Functions 2 March 15th 06 10:28 AM
Create a function to return text if two logical functions are true janeyt Excel Worksheet Functions 2 March 19th 05 08:49 PM


All times are GMT +1. The time now is 11:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"