Apache OpenOffice (AOO) Bugzilla – Issue 109070
optional param declareda as object: invalid use of an object
Last modified: 2017-05-20 11:27:36 UTC
declaring an optional param as "object" will cause an error: "invalid use of an object" - seems the param is not declared ... is it a bug or a feature ? OPTION EXPLICIT Sub TestCase() ' ok ... MsgBox "1 " & TestParam1(ThisComponent).getName() MsgBox "2 " & TestParam2(ThisComponent).getName() MsgBox "3 " & TestParam3(ThisComponent).getName() ' will fail ... MsgBox "4 " & TestParam4(ThisComponent).getName() End Sub Function TestParam1(oDoc as Object, Optional oOptional) as Object If IsMissing(oOptional) then oOptional = oDoc.getSheets().GetByIndex(0) End If TestParam1 = oOptional End Function Function TestParam2(oDoc as Object, Optional oOptional as Variant) as Object If IsMissing(oOptional) then oOptional = oDoc.getSheets().GetByIndex(0) End If TestParam2 = oOptional End Function Function TestParam3(oDoc as Object, Optional oOptional as Object) as Object If IsMissing(oOptional) then Dim oOptional oOptional = oDoc.getSheets().GetByIndex(0) End If TestParam3 = oOptional End Function Function TestParam4(oDoc as Object, Optional oOptional as Object) as Object If IsMissing(oOptional) then oOptional = oDoc.getSheets().GetByIndex(0) End If TestParam4 = oOptional End Function
Andreas, please have a look.
I tried, but I didn't find anything about this that could be declared as feature... ;-) STARTED, 3.x
Reset assigne to the default "issues@openoffice.apache.org".