How to check if excel is open?

MassiveAnt

New Member
Joined
Sep 13, 2006
Messages
4
How would I check if Excel is open already and get access to that application in my program. I'm using c# and 11.0 excel/office object library

What I'm eventually trying to do is check if an workbook is open

m_oExcel = new Microsoft.Office.Interop.Excel.ApplicationClass();

foreach (Workbook w in m_oExcel.Workbooks)
{
if (strName = w.Name) // then its open already....

}

but this creates a new excel app, so how would i grab a reference to an existing one?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,171,579
Messages
5,876,290
Members
433,192
Latest member
butterexcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top