Instead of instantiating a new instance, check for an existing one:
try
{
Microsoft.Office.Interop.Excel.Application app =
System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
}
catch
{
// Excel is not running.
}
More Related Contents:
- Why does Microsoft.Office.Interop.Excel.Application.Quit() leave the background process running?
- Set data type like number, text and date in excel column using Microsoft.Office.Interop.Excel in c#
- Reading Excel files from C#
- How to detect installed version of MS-Office?
- Reading Datetime value From Excel sheet
- Fastest method to remove Empty rows and Columns From Excel Files using Interop
- Closing Excel Application Process in C# after Data Access
- How to read an excel file in C# without using Microsoft.Office.Interop.Excel libraries
- Cell color changing in Excel using C#
- Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))
- Microsoft Office Excel cannot access the file ‘c:\inetpub\wwwroot\Timesheet\App_Data\Template.xlsx’
- How to read data from excel file using c# [duplicate]
- Get instance of Excel application with C# by Handle
- The quest for the Excel custom function tooltip
- How do I import from Excel to a DataSet using Microsoft.Office.Interop.Excel?
- How to make correct date format when writing data to Excel
- Importing Excel into a DataTable Quickly
- How to save workbook without showing save dialog with Excel interop?
- Query excel sheet in c#
- Optimal way to Read an Excel file (.xls/.xlsx)
- C# – How to add an Excel Worksheet programmatically – Office XP / 2003
- How do I properly clean up Excel interop objects?
- Reading excel file using OLEDB Data Provider
- How to get the range of occupied cells in excel sheet
- Disposing of Microsoft.Office.Interop.Word.Application
- How to open Outlook new mail window c#
- Accessing Excel Custom Document Properties programmatically
- Open XML SDK 2.0 – how to update a cell in a spreadsheet?
- Get the Column Index of a Cell in Excel using OpenXML C#
- Exception (HRESULT: 0x800AC472) when using Excel.Worksheet.Select after calling Excel.Workbook.SaveAs