on 05-12-2006 12:22 AM
Hello,
I am using the OLE methods to read from a EXCEL file and writing the data to the clipboard. The problem that we are facing is that once the report has executed if we try and open the Excel file, it only opens in 'READ ONLY' mode.
Any ideas why this is happening?
Following is the code snippet
Start EXCEL
CREATE OBJECT l_excel 'excel.application'.
IF sy-subrc <> 0.
WRITE:/ 'Excel cannot be started'.
ELSE.
Open the file
CALL METHOD OF l_excel 'workbooks' = l_workbook.
IF sy-subrc <> 0.
WRITE:/ 'Excel cannot be started'.
ENDIF.
CALL METHOD OF l_workbook 'open'
EXPORTING
#1 = p_file1.
IF sy-subrc <> 0.
WRITE:/ 'File cannot be opened'.
ENDIF.
.........
.........
.........
call method of l_workbook 'close'
EXPORTING
#1 = 'NO'.
Closing application
call method of l_excel 'QUIT'.
Free the object
free object: l_excel,
l_sheet.
Hi aviroop,
1. This happens bcos the instance of excel
is still there in the front-end.
(but its not visible)
2. if you press CtrlAltDel
to see the processes,
u will be able to see it.
3. Delete this instance / kill this instance
and then u will be able to open the file
again, in write mode also.
4. Closing application
call method of l_excel 'QUIT'.
Free the object
free object: l_excel,
l_sheet.
Unfortunately, the above code, manytimes
does not kill the excel instance.
5.*********************
To close the instance of excel,
a. Closing application
call method of l_excel 'QUIT'.
b. Free the object
free object: l_excel, l_sheet.
<b>c. FREE ALL OTHER OBJECTS ALSO if u have declared them,
viz cells, ranges, worksheet, workbook ,application</b>
regards,
amit m.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can you please send me all the methods related to excel file reading and creating using OLE.
Thanks in advance
Raghav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI
GOOD
AS PER YOUR REQUIREMENT I HOPE THERE WONT BE ANY MISTAKE IN YOUR CODE,WHAT YOU HAVE TO DO IS WHILE OPENING THE EXCEL FILE WHEN IT IS ASKING FOR READ ONLY MODE CLICK ON NO,OR SEE WHEATHER YOU HAVE ALREADY OPEN THE SAME EXCEL FILE.
THANKS
MRUTYUN
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.