Any tips on how to "attach" to an existing running instance of Excel (2000) from windows forms code written in C# (bit like GetObject instead of CreateObject).. Thanks
Any tips on how to "attach" to an existing running instance of Excel (2000) from windows forms code written in C# (bit like GetObject instead of CreateObject).. Thanks
(Excel.Application)Marshal.GetActiveObject("Excel.Application"); Will return the running instance of Excel. You might want to see if there are any running instances first though using System.Diagnostics.Process class. (2000)
Thanks for the info Scott ! It works although I when I reference to Excel my .NET objects seem to appended with "class". I have Excel.ApplicationClass and not Excel.Application, or Excel.WorkbookClass and not just Excel.WorkBook... Anyone have any ideas why that may be ? Thanks
Hi Giri, The Excel.Application is an interface while Excel.ApplicationClass is implement Class. You may have a look at the Excel Object Browse. You may do that by press Ctrl+Alt+J in the IDE. You may take a look at the example in the link below. 302815 HOW TO: Handle Events for Excel by Using Visual C# .NET http://www.**--****.com/ Excel.Application exApp = (Excel.Application)Marshal.GetActiveObject("Excel.Application"); Excel.Worksheet ws = (Excel.Worksheet)exApp.ActiveWorkbook.Worksheets.get_Item(1); ws.Cells[1,1]="100"; Can you post some code about where you use the Excel.ApplicationClass? Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights. -------------------- < XXXX@XXXXX.COM > cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08 .phx.gbl!tk2msftngp13.phx.gbl microsoft.public.office.developer.automation:7339 and
Thanks for the clarification. It is working now.
1.Automating existing instances of word ?
Hi all I'm trying to automate Word from another application After creating the Application object, Documents Collection and Document object. These objects only seem to know about the stuff i've just created within that app ? ie if word was already open and had three docs open they don't seem to be in the documents collection ? The app is not written in VB but a VB example would be good .... or am I doing something wrong ? TIA Andrew
2.Get an object representing an existing Excel instance from Outlook
If i already have an Excel instance running, how to do I control that instance from Outlook? I know that I can easily create a new instance from outlook and control that, but what i want to do is to create a new workbook in the existing instance and populate that workbook with data. How do i do this? ANy help would be most appreciated.
3.How to Show Existing IE Instance if Already Exists, Else Open One
Users browsing this forum: No registered users and 77 guest