05-09-2016 8:40 AM
Hi Experts,
I have copied an excel file then save it. But when i try to open the new excel, i cannot, i have message "excel is locked for editing by 'my user' ".
Here is my code:
CREATE OBJECT excel 'Excel.Application'.
SET PROPERTY OF excel 'VISIBLE' = 0.
CALL METHOD OF excel 'WORKBOOKS' = workarea.
CALL METHOD OF workarea 'OPEN'
EXPORTING
#1 = 'C:\excel1.xls'.
GET PROPERTY OF excel 'ACTIVEWORKBOOK' = workarea.
*copy sheet ELEUSIS1 -> sheet ELEUSIS1
CALL METHOD OF excel 'SHEETS' = work_copy
EXPORTING #1 = 'ELEUSIS1'.
CALL METHOD OF excel 'SHEETS' = workarea
EXPORTING #1 = 'ELEUSIS1'.
CALL METHOD OF workarea 'SAVEAS'
EXPORTING
#1 = 'C:\excel2.xls'.
#2 = 1.
CALL METHOD OF workarea 'close'.
* Quit the file
FREE OBJECT workarea.
CALL METHOD OF workarea 'QUIT'.
CALL METHOD OF excel 'QUIT'.
FREE OBJECT: excel.
Could you plz help me to close 'excel2'?
Thx.
Best regards,
Mehdi
05-09-2016 12:37 PM
I don't understand what you're trying to achieve with the 2 lines CALL METHOD OF excel 'SHEETS', especially the second one is problematic as you change workarea. Could you remove them, and try again?
05-09-2016 12:37 PM
I don't understand what you're trying to achieve with the 2 lines CALL METHOD OF excel 'SHEETS', especially the second one is problematic as you change workarea. Could you remove them, and try again?
05-09-2016 12:45 PM