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.
Visual C# General
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.
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.
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
Hi Gopi Kumar,
I want Excel.Application object from this process/processid
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.
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
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.
The following page may be useful for this issue.
http://support.microsoft.com/kb/316125/en-us
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