I need to pass mSheet to another function (in a more complicated situation than shown here). Sometimes there is an actual sheet but at other times there is no sheet, and I need to pass a Null value to indicate this. After the SS is closed, mSheet still refers to the original object, as one would expect, since mSS.close(True) does not "know" what use was being made of its sheets.
What's a workable way to do this? As I said, I seem to have a basic misunderstanding about this. Thanks for your help.
Code: Select all
Sub NullTest
Dim mSS as Object
Dim mSheet as Object
mSS = StarDesktop.LoadComponentFromUrl( "private:factory/scalc", "_blank", 0, Array())
mSheet = mSS.Sheets(0)
mSS.close(True)
mSheet = Null ' fails: Object variable not set
End Sub