Comparing objects in if statement

Hi

I have this problem
ActiveProject.Tasks(i).Name when I reach this poing the object is not initialized. But what every I try with I get an exception

if ActiveProject.Tasks(i).Name > ""
if ActiveProject.Tasks(i).Name is nothing = false

etc.etc. all fails

But I guess this is easy :)
/Joachim
LVL 4
joachimcAsked:
Who is Participating?
 
TimCotteeHead of Software ServicesCommented:
Use:

If Not (ActiveProject.Tasks(i) Is Nothing) Then

You need to refer to the object, not a property thereof.
0
 
joachimcAuthor Commented:
aha I missed the perentecis.
/Joachim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.