MrZap

Hello,
           Using following line i got all running Process/Instance of Excel :
           Process.GetProcessesByName("EXCEL"). 

           But after this i don't know how to get object from process/processid.




Re: Visual C# General How To Get Excel Object From Process?

TilakGopi

Hi,

But after this i don't know how to get object from process/processid.

Which object or what type of object u want to get from this process

Excuse my ignorance.

Thanx,

Ch.T.Gopi Kumar.






Re: Visual C# General How To Get Excel Object From Process?

Figo Fei - MSFT

Hi, Jigar

The method returns an array of the process, for more information of operation, see: http://msdn2.microsoft.com/en-us/library/725c3z81.aspx

Thanks






Re: Visual C# General How To Get Excel Object From Process?

Jigar Patel

Hi Gopi Kumar,

I want Excel.Application object from this process/processid






Re: Visual C# General How To Get Excel Object From Process?

Jigar Patel

Hello,

I already got the EXCEL process/processid from Process.GetProcessesByName Method. But i don't know how to get Excel object from process/processid.






Re: Visual C# General How To Get Excel Object From Process?

Figo Fei - MSFT

Hi,

Reference to interop with com interop with excel, check this out: http://msdn2.microsoft.com/en-us/microsoft.office.interop.excel(VS.80).aspx

Thanks






Re: Visual C# General How To Get Excel Object From Process?

TilakGopi

Hi Jigar,

The following code may do ur job..



object exobj = Marshal.GetActiveObject("Excel.Application");
Microsoft.Office.Interop.Excel.
Application IEC = (Microsoft.Office.Interop.Excel.Application)exobj;
MessageBox.Show(IEC.Caption);


 

Thanx,

Ch.T.Gopi Kumar.

 






Re: Visual C# General How To Get Excel Object From Process?

Kazuya Ujihara

The following page may be useful for this issue.

http://support.microsoft.com/kb/316125/en-us





Re: Visual C# General How To Get Excel Object From Process?

Jigar Patel

Hi TilakGopi And Kazuya Ujihara,

I already tried with Marshal.GetActiveObject. This is usefull but what we can do if Excel Instance open more then one. Marshal.GetActiveObject will return only one object and if i want to use second or third instance object of Excel then what can i do. So that'swhy i got second way that using Process.GetProcessesByName will return all processes of Excel Instance. but i don't know how can i get Excel object from that process/processid