I have written a Macro in Excel for a friend of mine, which he now needs porting so that it works with Open Office (current version)
I have sorted most of the issues, such as the fact that OO uses ; instead of , as a argument separator, but I have one remaining problem.
Parts of the macro rely on copying and pasting data across the spreadsheet, and none of this is actually happening. The macro doesn't ever fall over or register that there is a problem, it just doesn't do these certain steps.
What is going on?
Trouble porting from Excel to Open Office
Re: Trouble porting from Excel to Open Office
I suggest you post the code so the experts in this forum can have a look.
LibreOffice 4.2.3.3. on Ubuntu 14.04
Re: Trouble porting from Excel to Open Office
Code: Select all
REM ***** BASIC *****
Sub test_copyRange
REM copy from 1st sheet B2:F5 to 2nd sheet A1
copyRange oDoc:=thisComponent, nSh:=0, nStartCol:=1, nStartRow:=1, nEndCol:=5, nEndRow:=4, nTgtSh:=1, nTgtCol:=0, nTgtRow:=0
End Sub
Sub copyRange(oDoc, nSh, nStartCol, nStartRow, nEndCol, nEndRow ,nTgtSh, nTgtCol, nTgtRow)
Dim oSrc as new com.sun.star.table.CellRangeAddress
Dim oTgt as new com.sun.star.table.CellAddress
oSh = oDoc.Sheets.getByIndex(nSh)
oSrc.Sheet = nSh
oSrc.StartColumn = nStartCol
oSrc.StartRow = nStartRow
oSrc.EndColumn = nEndCol
oSrc.EndRow = nEndRow
oTgt.Sheet = nTgtSh
oTgt.Column = nTgtCol
oTgt.Row = nTgtRow
oSh.copyRange(oTgt, oSrc)
End Sub
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Trouble porting from Excel to Open Office
Are you suggesting that you have to write a sub routine to copy and then paste to a range of cells?
Re: Trouble porting from Excel to Open Office
Since you do not tell us anything, I wrote a subroutine which can be used to copy any range to any target cell within any spreadsheet document. I simply split up everything into the most tiny steps to make it as generic and plausible as possible. In the end it is nothing but a single call of method copyRange with a cell address and a range address. It's completely up to you to understand the concept and write something completely different. You could also leave it as is, copy sub test_copyRange and put the numbers you need. All the indices for sheets, columns and numbers are zero based.TheCherub wrote:Are you suggesting that you have to write a sub routine to copy and then paste to a range of cells?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Trouble porting from Excel to Open Office
Sorry, that reply of mine was uncalled for.
The person I am writing it for has now found himself a copy of Excel, so the issue has been sidestepped. Thank you to all who posted though.
The person I am writing it for has now found himself a copy of Excel, so the issue has been sidestepped. Thank you to all who posted though.