In his OpenOffice.org Macro document, Andrew Pitonyak says:
16.2.6. Should I Use Object Or Variant
When writing code that interacts with the UNO objects, you must decide which type to use. Although most examples use Object, page 132 of the Developer’s Guide suggests otherwise.
Always use the type Variant to declare variables for UNO objects, not the type Object. The OpenOffice.org Basic type Object is tailored for pure OpenOffice.org Basic objects and not for UNO OpenOffice.org Basic objects. The Variant variables are best for UNO objects to avoid problems that can result from the OpenOffice.org Basic specific behavior of the type Object:
Dim oService1 ' Ok
oService1 = CreateUnoService( "com.sun.star.anywhere.Something" )
Dim oService2 as Object ' NOT recommended
oService2 = CreateUnoService( "com.sun.star.anywhere.SomethingElse" )
I checked the developer documentation, and it says:
Always use the type
Variant
to declare variables for UNO Basic objects, not the typeObject
. The LibreOffice Basic typeObject
is tailored for pure LibreOffice Basic objects and not for UNO LibreOffice Basic objects. TheVariant
variables are best for UNO Basic objects to avoid problems that can result from the Template:V Basic specific behavior of the typeObject
:
However, in a separate discussion, the idea was mentioned that this information may no longer be correct due to updates to LO Basic that may have improved compatibility between the LO Basic Object
type and the UNO Object
.
Can anyone confirm (or has anyone heard) that this information is no longer up-to-date?