is there any difference between work om Office 2007 and 2003 in C#
i work with Office 2007 (excell) in my C# program.
i do this reference: Microsoft Excel 12.0 Object Library
开发者_StackOverflow
it work excellent !, but if in the computer there is Office 2003
is it work good ? if not, what i need to do ?
thank's in advance
You need to do late binding for it to work with multiple versions of office. Here's some VB.Net code I had laying around but it should show you the difference between late and early binding at least.
Dim objWordApplication As Object
try
objWordApplication = GetObject(, "Word.Application")
Catch ex As Exception
If Err.Number = 429 Then '429 means Word is not running
objWordApplication = CreateObject("Word.Application") 'start a new instance
End If
End Try
Dim objWordDocument As Object = objWordApplication.Documents.Add("docname.doc")
精彩评论