Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

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
0
joachimc
Asked:
joachimc
1 Solution
 
TimCotteeCommented:
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

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now