views:

17

answers:

1

I am using

Microsoft.Office.Interop.Excel.Application oExcelApp = 
                     (Microsoft.Office.Interop.Excel.Application)Marshal.GetActiveObject("Excel.Application");

in my project. It gives me an error when there is no Excel file open at the moment. How can I check to see if there is no Excel file running?

+1  A: 

Here is approach of using Marshal.GetActiveObject and how to handle situation if object not found. Hope this will help.

Eugene Cheverda