To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=109070 Issue #|109070 Summary|optional param declareda as object: invalid use of an |object Component|scripting Version|OOo 3.2 RC5 Platform|Unknown URL| OS/Version|All Status|NEW Status whiteboard| Keywords| Resolution| Issue type|DEFECT Priority|P3 Subcomponent|code Assigned to|kr Reported by|brinzing
------- Additional comments from [email protected] Tue Feb 9 10:24:00 +0000 2010 ------- 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 --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
