View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Alan[_8_] Alan[_8_] is offline
external usenet poster
 
Posts: 117
Default Help! Problem Referencing Excel 2003 in VB.NET

I am using Visual Studio 2008 Express Edition to develop some VB.NET
code that manipulates Excel files. I am developing on a Vista/Excel
2007 machine, but I need the code to work on an XP/2003 machine as
well.

I initially set a reference to the Microsoft Excel 12.0 Object Library
and imported the Microsoft.Office.Interop.Excel namespace. This works
great on the VIsta/Excel 2007 machine, but it does not work on 2003,
which needs the 11.0 library. I get an error that says "Unhandled
Exception . . . Could not file or assembly
'Microsoft.Office.Interop.Excel, Version 12.0.0.0 . . . The system
cannot find the file specified."

I searched through the other references I could find. I found nothing
for 11.0, but there was an Excel 5.0 Object Library. When I add this
and remove the Excel 12 library reference, it no longer works on
Vista.

What can I do to make this work on both Excel 2003 and 2007 without
having to compile on a machine with 2003?

Thanks, Alan