How to test for unset global object?

I need to create a global BitmapTable object. I want to be tidy and only create the instance I need, so I want to test the variable before I set it. So I do an IsNull() test on it, so that I only set it if I havn’t set it before.

However, the IsNUll() test never triggers on my brand new Global object, so the createInstance never happens.

But then, when we get to oBitmaps.hasByName(), this fails because of “Object variable not set”.

I am clearly missing some understanding. Why is my global object not null before use? How else should I test whether it is set?

Many thanks

Andrew

Global oBitMaps
Sub Main
if ( IsNull(oBitmaps) ) then
	rem this branch never executes
	msgbox "Null"
	oBitmaps = oCalcDoc.createInstance( "com.sun.star.drawing.BitmapTable" )
else
	msgbox "Not Null"
	rem I have already created my instance of oBitmaps, no need to create another.
end if
if ( oBitmaps.hasByName( "Test" ) ) then rem <<<< Object variable not set!
	rem do something interesting
End if
End Sub

Found the answer. I want IsEmpty(), not IsNull()

I don’t have enough Karma to mark this as an answer :frowning: