Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, March 22, 2007 11:20 AM
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.
All replies (9)
Friday, March 23, 2007 10:14 AM ✅Answered
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
Friday, March 23, 2007 11:51 AM ✅Answered
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.
Thursday, March 22, 2007 12:18 PM
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.
Friday, March 23, 2007 10:32 AM
Hi Gopi Kumar,
I want Excel.Application object from this process/processid
Friday, March 23, 2007 10:36 AM
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.
Friday, March 23, 2007 11:03 AM
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
Friday, March 23, 2007 2:21 PM
The following page may be useful for this issue.
http://support.microsoft.com/kb/316125/en-us
Saturday, March 24, 2007 4:44 AM
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?
Friday, September 19, 2008 4:55 PM
MrZap
Probably you'll find this interface helpful
Workbooks Interface
A collection of all the Workbook objects that are currently open in the Microsoft Excel application.
Namespace: Microsoft.Office.Interop.Excel
http://msdn.microsoft.com/en-us/microsoft.office.interop.excel.workbooks(VS.80).aspx
Mr.L