Hi,
I have a problem with exporting data to excel.
This occurs since we updated our systems to MS Office 2007.
I use Automation Variables in C/AL Code to work with excel. But I get very often the following error:
'<Reportname>' cannot close because the system is currently working.
Seems my report ends and Excel is still working.
Before my report ends I save and close the Excel file and quit excel
xlApp - Automation - 'Microsoft Excel 12.0 Object Library'.Application
xlApp.ActiveWorkbook.Save;
xlApp.ActiveWindow.Close;
xlApp.Quit;
Does anyone have a suggestion how to avoid this error?
The Problem is, that we use NAS to periodically create Excel Files and send them by email to our customer.
When the error occurs, the sending of the email fails as well.
Comments
I had the same experience and I was able to solve it with the CREATE.
Are you doing CREATE(xlApp)?
If so, try CREATE(xlApp,TRUE). This way your report will create a new Excel Application for your report.
I noticed I had that problem when I already had Excel open on the client computer.
Also make sure you Clear your automation with CLEAR(xlApp).
Hope this helps,
Willy