cancel
Showing results for 
Search instead for 
Did you mean: 

Excel still running after OLE program ends

Former Member
0 Kudos

I've spent all day on this and am getting nowhere, so it's time to turn it over to the experts here.

Env: WAS640

I have a very simple ABAP program that does some OLE with Excel. When the program is finished, EXCEL.EXE is still running on the PC (can see in task manager). After running the program 4 times, EXCEL.EXE shows up four times in the task manager.

I'm using FREE OBJECT on every OLE object, I'm FLUSHING... I don't get it. This does not happen in our old 620 system, on which we still run some apps.

One other oddity. When I debug my wrapup code...

SET PROPERTY OF excel 'DisplayAlerts' = 0.

CALL METHOD OF workbooks 'CLOSE'.

SET PROPERTY OF excel 'VISIBLE' = 1.

CALL METHOD OF excel 'QUIT'.

FREE OBJECT workbook.

FREE OBJECT workbooks.

FREE OBJECT excel. "Excel.Application

... and get to the 3rd line, Excel pops up on my screen and I can see that the workbooks are closed properly. But when I step through the 'QUIT' method, the application doesn't shut down, and I can still see the icon in my taskbar. Not sure if it's supposed to disappear at that point or not.

Whwn I free the excel object, the icon disappears, but the process is still alive in task manager.

Any ideas?

Thanks

Chris

Message was edited by: Chris Perkins

Accepted Solutions (0)

Answers (1)

Answers (1)

andreas_mann3
Active Contributor
0 Kudos
VXLozano
Active Contributor
0 Kudos

It's an Office's bug. I had the same troubles calling Word and Excel from VB programs and Exchange forms (forms in Exchange are reports in SAP).

Some times the system cannot close the Office program, when you FREE your object, you only clear the pointer to your Excel session... check your closing methods (maybe your system is not able to close your sheet, but trying to do it invisible, you cannot see it).

Try to do all the process in visible mode, and allowing Excel to display pop-ups. Maybe it is trying to ask you if you want to save the file and is waiting for your answer.

Check the Office's help to check the parameters of your called functions (quit and close) to see what do you need to say Excel to close without ask nothing...

close without saving

if NOT "more documents open"

quit excel

endif

free object

More or less this is the way to do it. But I'm talking you from my memories, 4 or 5 years ago...

Former Member
0 Kudos

Well, I've already done everything in note 124658 (and 129994 and 721793)... as I mentioned in my original post, all objects are freed (and the code works fine in a 620 environment). I've also made the Excel session visible, and don't see anything unusual going on that would explain the persistent thread.

I've gotten around it for now by writing a call to a batch file that issues a taskkill command to the Excel process, but I was hoping for something a little cleaner.