Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help! Problem Referencing Excel 2003 in VB.NET
I changed the reference to Excel 5.0 only and now only Import Excel.
I changed starting an instance of Excel to: ExcelApp = CreateObject("Excel.Application") The following code cannot open the workbook: If FileExists(PathName) Then MetaWB = ExcelApp.Workbooks.Open(PathName) It finds that the file exists, but then the workbook cannot be opened: A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll Any ideas? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel (2003) crashes when referencing to external workbook in freezeframe | Excel Worksheet Functions | |||
Referencing Comments in Excel 2003 | Excel Discussion (Misc queries) | |||
Excel 2003 - Referencing data in a table to use in formulas | Excel Worksheet Functions | |||
Excel 2003 Referencing multiple worksheets | Excel Discussion (Misc queries) | |||
Excel 2003 Referencing multiple workbooks via single variable | Excel Worksheet Functions |