ooo basi9c, adding strings in calc [closed]

asked 2014-06-24 17:57:47 +0200

altair gravatar image

updated 2014-06-24 17:59:16 +0200

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!!!

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by altair
close date 2014-06-24 18:21:53.051259