Hello!
Please, I want to change values of the cells in calc.
Want to add sign “+++” to each.
Here is the code:
sub x
Dim oDoc As Object
Dim oSheet As Object
Dim oCell As Object
nrRows=10
nrCols=6
oDoc=ThisComponent
oSheet=oDoc.Sheets(0)
oCell = oSheet.GetCellbyPosition( 0, 0 )
oCursor = oSheet.createCursorByRange(oCell)
oCursor.GotoEndOfUsedArea(True)
aAddress = oCursor.RangeAddress
nrRows = aAddress.EndRow
nrCols = aAddress.EndColumn
For c = 0 To nrCols
For r = 0 To nrRows
oCell = oSheet.GetCellByPosition( c,r )
va = oCell.Formula
va.setString change(va.getString)
oCell.Formula=va
msgbox(va, 48+1, "Cell value in the column: " & c)
if msgbox(va, 48+1, "Cell value in the column: " & c)=2 then exit sub
Next r
Next c
end sub
function change(s)
change=s & "***"
end function
It says, for the code row:
va.setString change(va.getString)
That the error is here: (object variable not set).
Please, can someone help?
many thanks!!!