471,114 Members | 1,422 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,114 software developers and data experts.

Problem with Interop.Excel after uninstalling Office 2007 and installing Office 2003

I am developing a VB.Net application with VS 2005 that opens an Excel
workbook and populates the worksheet with data. I started developing the
application with Office 2007 installed on my Vista OS, but after I
discovered that it won't run on a system with Office 2003, I uninstalled
Office 2007 and installed Office 2003. I reset the reference in .Net to the
Microsoft Excel 11.0 Object Library. The application works fine from the
..Net IDE but when I compile and run the .Exe I get the following error

************** Exception Text **************
System.InvalidCastException: Unable to cast COM object of type
'Microsoft.Office.Interop.Excel.ApplicationClass' to interface type
'Microsoft.Office.Interop.Excel._Application'. This operation failed because
the QueryInterface call on the COM component for the interface with IID
'{000208D5-0000-0000-C000-000000000046}' failed due to the following error:
could not be found. (Exception from HRESULT: 0x80030002
at Microsoft.Office.Interop.Excel.ApplicationClass.ge t_Workbooks()
at RunExcel.Form1.btnRunOutsideForm_Click(Object sender, EventArgs e) in
D:\FMI\Dev\NetPlay\VS2005\RunExcel2003\RunExcel\Fo rm1.vb:line 22
at System.Windows.Forms.Control.OnClick(EventArgs e)

This did not occur with the original Office 2007 installation. I've tried
running Office repair, uninstalling and reinstalling Excel .Net program
support from the Office installation, but none of this works. The exe works
on my test platform running WinXP and Office 2003 (clean installation where
Office 2007 was never installed).

It makes no difference whether Option Strict is on or off. The code is

Dim excelApp As Excel.Application = New Excel.Application
MessageBox.Show("After Dim excelApp As Excel.Application = New

Dim Wbk As Excel.Workbook
MessageBox.Show("After Dim Wbk as Excel.Workbook")

Wbk = excelApp.Workbooks.Add()
MessageBox.Show("After Wbk = excelApp.Workbooks.Add()")

excelApp.Visible = True
MessageBox.Show("After excelApp.Visible = True")

It bombs at Wbk = excelApp.Workbooks.Add(). I've tried using
ApplicationClass and CreateObject but none of that works either.

Anyone know how to fix this short of reinstalling the entire operating


Apr 29 '07 #1
0 3897

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by J-T | last post: by
2 posts views Thread by Alex D. | last post: by
3 posts views Thread by Dustin van de Sande | last post: by
2 posts views Thread by Dean Slindee | last post: by
15 posts views Thread by =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?= | last post: by
reply views Thread by TBass | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.