Using VB.NET in VS2008, I'm trying to read/write from an Excel 2007 .xlsx file. I've included COM references to the Microsoft Excel 12.0 and 5.0 Object Libraries.
Every time I try to run the program, though, I'm getting a Member Not Found error (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND)).
Here's the code that's throwing the error; it happens on the second line:
Dim xcApp As Excel.Application = CreateObject("Excel.Application")
Dim xcWB As Excel.Workbook = xcApp.Workbooks.Open("C:\TestFile.xlsx")
Dim xcWS As Excel.Worksheet = CType(xcWB.Worksheets(1), Excel.Worksheet)
The file C:\TestFile.xlsx does exist, so that's not what's causing it. Does anyone have any idea what I'm doing wrong? Thanks in advance for your help.