Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Error checks for ActiveDocument.GetSheetObject(myString)

Hi,

In

set chart = ActiveDocument.GetSheetObject(myString)

I want to check for errors, suppose the chart object doesn't exist. What does the chart return, i thought it would return null, but apparently "if not isnull(chart) then" doesn't work.


Can anybody tell me (in code) what the test for a chart object not being found is?

1 Solution

Accepted Solutions
Not applicable
Author

IsNull doesn't work, because VB Script is kind of funny about Nulls. VB Script has three types of Null (not counting the empty string), Null, Empty and Nothing. Nothing is for objects (you'll see objects set to Nothing when they are no longer needed in a sub).

Apparently, IsNothing isn't available, but here is a way to test for Nothing:

Sub Tester
set chart = ActiveDocument.GetSheetObject("CH9999")
If TypeName(chart) = "Nothing" Then
' The object is empty
End If
End Sub


View solution in original post

1 Reply
Not applicable
Author

IsNull doesn't work, because VB Script is kind of funny about Nulls. VB Script has three types of Null (not counting the empty string), Null, Empty and Nothing. Nothing is for objects (you'll see objects set to Nothing when they are no longer needed in a sub).

Apparently, IsNothing isn't available, but here is a way to test for Nothing:

Sub Tester
set chart = ActiveDocument.GetSheetObject("CH9999")
If TypeName(chart) = "Nothing" Then
' The object is empty
End If
End Sub