We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to check if Excel is currently open, using XlsIO?

Hi,

In my application I wish to export to Excel a worksheet (containing a chart). To do this I need to know if Excel is already up and running (to avoid re-starting Excel when it is already open, which causes a crash). I am not sure how to reference the Excel (application) object? For example, I wish to write something like

if (Application != null)
{ \\ open Excel and export }

where Application represents Excel, but I am not sure how to do this correctly?
My second question follows on from this, I then wish to check for any open workbooks, e.g.

if (Application.Workbooks != null)

If you can provide any help on this, would be much appreciated. Thanks in advance.



3 Replies

FS Farman Samee February 22, 2010 11:09 AM UTC

apologies I think I wrote down the wrong email..



FS Farman Samee February 22, 2010 11:11 AM UTC

PS- I would still like help with this!!



GM Geetha M Syncfusion Team February 23, 2010 09:02 AM UTC

Hi,

Thank you for your interest in Syncfusion products.

It is always preferred to close ExcelEngine object after all the workbook operation gets over. Hence you may check if the ExcelEngine is null or not. Also, to check for the open workbooks, you may check if application.ActiveWorkbook is null or not.

application.ActiveWorkbook

Please try this and let us know if you have any questions.

Regards,
Geetha

Loader.
Live Chat Icon For mobile
Up arrow icon