How to perform OLE Automation 
Author Message
 How to perform OLE Automation

Hi,

In VB, I can create an Excel spreadsheet using the
following code,

   Dim excel As Object
   Set excel = CreateObject("Excel.Sheet")

Is there an equivalent of the CreateObject & GetObject
functions in C#?

Thanks.



Wed, 06 Oct 2004 10:34:59 GMT  
 How to perform OLE Automation
Hello Jonathan,

I think the Activator.CreateComInstanceFrom and the
Activator.CreateInstanceFrom methods are helpful. The can create an
instance of the type whose name is specified, using the named assembly file
and the constructor that best matches the specified parameters. And then
use the ObjectHandle.Unwrap method to unwrap the return value. Please note:
you should import the DLL to an Assembly with the tlbimp.exe tool. For more
information about how to use the Activator.CreateComInstanceFrom and the
Activator.CreateInstanceFrom methods please see:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpre...
frlrfsystemactivatorclasscreatecominstancefromtopic.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpre...
frlrfsystemactivatorclasscreateinstancefromtopic1.asp

I hope this information is helpful.

Best regards,

Lion Shi, MCSE, MCSD
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.  2001 Microsoft Corporation. All rights
reserved.
--------------------
    Content-Class: urn:content-classes:message


    Subject: How to perform OLE Automation
    Date: Fri, 19 Apr 2002 19:34:59 -0700
    Lines: 12

    MIME-Version: 1.0
    Content-Type: text/plain;
        charset="iso-8859-1"
    Content-Transfer-Encoding: 7bit
    X-Newsreader: Microsoft CDO for Windows 2000
    X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    Thread-Index: AcHoE/dY4COqsiMHRiGKATnee/EEDA==
    Newsgroups: microsoft.public.dotnet.languages.csharp
    Path: cpmsftngxa08
    Xref: cpmsftngxa08 microsoft.public.dotnet.languages.csharp:55295
    NNTP-Posting-Host: TKMSFTNGXA11 10.201.226.39
    X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

    Hi,

    In VB, I can create an Excel spreadsheet using the
    following code,

       Dim excel As Object
       Set excel = CreateObject("Excel.Sheet")

    Is there an equivalent of the CreateObject & GetObject
    functions in C#?

    Thanks.



Sat, 09 Oct 2004 16:34:21 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. OLE automation and Symantec PC AnyWhere Scheduled Tasks

2. Builting an OLE automation server

3. OLE Automation in C

4. OLE Automation in C

5. OLE Automation in C

6. Documentation for OLE automation

7. OLE Automation: How to load Word-Document from DAO

8. Saving and retrieving Ole-Automation objects from Dao and MFC using CLongBinary class

9. CDaoDatabase, Access, & OLE Automation Error

10. OLE Automation error

11. RichEdit Control and OLE Automation

12. OLE Automation error in Access Database

 

 
Powered by phpBB® Forum Software