I am using the Microsoft .NET Framework SDK v1.1. I am trying to add a reference to the Microsfot Excel Object Library.
Am I correct in assuming this is done by using the reference switch with csc? If it is possible to do with the framwork, what filename should I be passing?
Are you trying to message excel like the old COM days? If so I believe that you have to do so using com Interop ( because excel is still a COM application ). We have software in he field that does this every day.
Here is a little snippet of code ripped from one of my test apps that plays with excel extensively. I have not added any references to excel in the references section. I am using Late binding which may or may not be appropriate for you setup. We use late binding
because the application needs to be able to run in systems where excel is not installed.
Formatting in this message editor is less than ideal but you should be able to get the point... Please no flames about the inherant issues in this code I know they are many Its only from one of my test rigs folks....
Dim ex As Object
Dim sh As Object
Dim iRatingIndex As Integer
For iRatingIndex = 0 To sCategories.GetUpperBound(0)
Dim _workbook As Object
ex = CreateObject("Excel.Application")
Catch trouble As Exception
MsgBox(trouble.Message, MsgBoxStyle.Exclamation, "Houston... we have a problem")
Yeah, eventually figured out that was what was wrong.
Going to get myself some books on C#, although will have to wait a bit, as had to buy some books for my physics course.
Probably get Visual C#.NET Standard soon as well, but I'll start off with the evaluation copy of Visual Studio I have.
Thanks for all the quick replies
Is there a reason why you need to create an Excel object?
You can easily have your app output an Excel xml file.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.