Created attachment 74856 [details]
Spreadsheet that fails in LO 4.0
This sample code silently completes on LO Calc 3.5 but fails on 18.104.22.168
We pass an address in the second argument to MakePropertyValue()
in 3.5, this works. In 4.0, the address is empty.
The comments in-line help to explain.
Rem This script is designed to work on the default, empty spreadsheet
oSheet = ThisComponent.Sheets.getByName("Sheet1")
Dim aAddress as New com.sun.star.table.CellAddress
rem get the address of a cell (any cell):
aAddress = oSheet.getCellByPosition(5, 5).getCellAddress()
Rem prove that the address is valid
Msgbox "Address of this cell: Column=" & aAddress.Column & "; Row=" & aAddress.Row & "; Sheet=" + aAddress.Sheet
Rem Call a popular function with the address
MakePropertyValue( "SourcePosition", aAddress )
Rem MakePropertyValue() is a common function used by many
Rem in 4.0, the stack trace shows that the second argument is an address but it has no value
Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
Dim oPropertyValue As New com.sun.star.beans.PropertyValue
If Not IsMissing( cName ) Then
oPropertyValue.Name = cName
Rem This is where things go wrong. In 4.0, uValue is not missing (it is an address) but it has no value:
If Not IsMissing( uValue ) Then
Rem in 4.0 the script stops here with the error "Object Variable not set"
oPropertyValue.Value = uValue
MakePropertyValue() = oPropertyValue
@Noel - I think I was told you're the go to for macros - any ideas on this one?
please check latest libreoffice releases before reporting, this has been fixed for a while and is working as expected in 4.0.1
*** This bug has been marked as a duplicate of bug 60117 ***
For my own honour, I would point out that this bug was checked against the latest release available at the time when it was reported.