When an Object doesn't exist ? 
Author Message
 When an Object doesn't exist ?

When an Object doesn't exist ?Put an error trap around the reference and check for the specific error or ignore any error...

On Error Resume Next
...make the reference
If Err.Number = <the exact error number> Then
    ...
    ...this is the "expected" error
    ...
ElseIf Err.Number <> 0 Then
    ...
    ...unexpected error
    ...
End If
Err.Clear
On Error GoTo 0

--
Michael Harris

I have script that enumerates a computers services into a spreadsheet.  I tried to add to the spreadsheet the value of service.dependencies object.  It works until there is a service without a dependency.  After trying a few ways around this (IsNull, IsEmpty, <> "") and a few more kludge ways, I can only assume that the object doesn't even exist when there are no dependencies. (I guess this makes sense) Can anyone verify?  

With that being said, is there a way to report the value if the object exists and skip if it doesn't?  I feel like I'm missing something obvious.

Any help would be appreciated?

tw                      



Fri, 28 Dec 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. files exists or not - says that it doesn't exist

2. RegRead throws an exception when the variable doesn't exist

3. RegRead:. Key doesn't exist

4. VBScript doesn't see C# object as object

5. Object doesn't support this property or method : 'DTSGlobalVariables(...).Value.Open

6. Object doesn't support this property or method

7. Object doesn't support this property/method??????

8. Object doesn't support this property or method

9. IE 5.0: Object doesn't support property or method

10. Object doesn't support this property or method

11. JScript doesn't Release COM objects?

12. Object doesn't support this property or method

 

 
Powered by phpBB® Forum Software