I want to append data to an existing excel file at the end. I want to use the 'END' property to get to the next empty row but I cannot get the 'END' property of class RANGE to work.
Here is the code that I use:
CREATE OBJECT excel_object 'EXCEL.APPLICATION' .
SET PROPERTY OF excel_object 'VISIBLE' = 1 .
GET PROPERTY OF excel_object 'WORKBOOKS' = workbook_list.
Open file
CALL METHOD OF workbook_list 'OPEN' = workbook
EXPORTING #1 = filepath.
CALL METHOD OF workbook 'ACTIVATE'.
Open first worksheet
CALL METHOD OF excel_object 'WORKSHEETS' = worksheet
EXPORTING #1 = 'STATS'.
CALL METHOD OF worksheet 'ACTIVATE'.
Get last active cell
CALL METHOD of excel_object 'RANGE' = range
exporting #1 = 'A1'.
CALL METHOD of range 'SELECT'.
GET property of excel_object 'SELECTION' = range2.
CALL METHOD OF range2 'END' = range3 " <= fails at this
EXPORTING #1 = 'xlDown'.
I have prior experience with automation and have tried various combinations by using diffrent handles and code combination like trying to use GET PROPERTY instead of CALL METHOD or changing the order etc. This one best emulates the macro that was recorded in excel.
How do I get this to work....any ideas??