Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / September 2003

Tip: Looking for answers? Try searching our database.

Using Excel Type Library 5.0 in C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Henrik Hofmann - 16 Sep 2003 12:06 GMT
Hi all,

I'm trying to use the Excel 5.0 Type Library in C#

I've managed to create an Excel Instance using
Excel._ExcelApplicationClass xl = new Excel._ExcelApplicationClass();

But now I don't know how to go on, opening an template writing into it and
to print.

Most examples on the net don't use C# and can access the Application
Interface directly. I'm not able to cast _ExcelApplicationLClass() to
Application which would offer the methods to make Excel visible etc.

Thanks for your help
Paul Clement - 16 Sep 2003 16:07 GMT
¤ Hi all,
¤
¤ I'm trying to use the Excel 5.0 Type Library in C#
¤
¤ I've managed to create an Excel Instance using
¤ Excel._ExcelApplicationClass xl = new Excel._ExcelApplicationClass();
¤
¤
¤
¤ But now I don't know how to go on, opening an template writing into it and
¤ to print.
¤
¤
¤
¤ Most examples on the net don't use C# and can access the Application
¤ Interface directly. I'm not able to cast _ExcelApplicationLClass() to
¤ Application which would offer the methods to make Excel visible etc.

You may want to check the following MS KB articles:

http://makeashorterlink.com/?A2B843AE5

Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
Henrik Hofmann - 16 Sep 2003 17:17 GMT
Thanks for your help but all listed articles need excel 2002, I'm trying to
automate using excel97 so i can't use oxppia.

bye

> ¤ Hi all,
> ¤
[quoted text clipped - 20 lines]
> Paul ~~~ pclement@ameritech.net
> Microsoft MVP (Visual Basic)
Paul Clement - 16 Sep 2003 19:08 GMT
¤ Thanks for your help but all listed articles need excel 2002, I'm trying to
¤ automate using excel97 so i can't use oxppia.
¤

Not all of those references implement the PIA. For example, the following uses the standard interop
assembly:

http://support.microsoft.com/default.aspx?scid=kb;en-us;302084

Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
Henrik Hofmann - 16 Sep 2003 21:32 GMT
This may be due to a different version of the type library but i can't call
Excel.Application xl = new Excel.Application(); only
Excel._ExcelApplicationClass xl = new Excel._ExcelApplicationClass();

When i use the library Excel.Application is an interface and not a class so
i can't instatiate it. _ExcelApplicationClass can't be casted to Application
and doesn't offer the same methods as Application.

> ¤ Thanks for your help but all listed articles need excel 2002, I'm trying to
> ¤ automate using excel97 so i can't use oxppia.
[quoted text clipped - 7 lines]
> Paul ~~~ pclement@ameritech.net
> Microsoft MVP (Visual Basic)
Paul Clement - 18 Sep 2003 15:27 GMT
¤ This may be due to a different version of the type library but i can't call
¤ Excel.Application xl = new Excel.Application(); only
¤ Excel._ExcelApplicationClass xl = new Excel._ExcelApplicationClass();
¤
¤ When i use the library Excel.Application is an interface and not a class so
¤ i can't instatiate it. _ExcelApplicationClass can't be casted to Application
¤ and doesn't offer the same methods as Application.

Is there a reason why you're using the Excel 5.0 library? Excel 97 implements the version 8.0
library.

Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.