Excel object

  • Thread starter Thread starter Adine
  • Start date Start date
A

Adine

Hi,

How can I have access to the excel files which are already opened? I tried
this:

excelObj = new Excel.Application();
MessageBox.Show(this, excelObj.Workbooks.Count.ToString());

But it shows always zero, nomatter how many excel files are already opened.
I need to have access to the current opened excel files. How?

Thanks,

Adine
 
I tried this too but still it's not working

excelObj =
(Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
 
there's code in here posted 2 weeks back to do the same thing. google for it

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
 
Back
Top