Question excel runtime error

babsjoy

New member
Joined
May 16, 2012
Messages
2
Programming Experience
10+
I have a VB.net windows application developed using VS2008 running on a Windows 7 machine calling EXCEL 2003. When the application calls Excel to EXPORT a workbook the workbook appears unpopulated and the below detailed error message is displayed. This error does not appear for all users. Most users can install the application using CLICK ONCE and are fine. I created an .MSI file for the users with the below issues but this didn’t help. Could it be they don't have the correct .dll file on their machine? Any ideas?

System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel.Workbook'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208DA-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).
at WindowsApplication3.Module1.PrintSetup2(Int32 PrinOut)
at WindowsApplication3.Form1.ToolStripMenuItem1_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.MenuStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5456 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Template Selection
Assembly Version: 2.0.9.7
Win32 Version: 2.0.9.7
CodeBase: file:///C:/engplan/template%20selection/Template%20Selection.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.5420 (Win7SP1.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5456 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5456 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5458 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
Microsoft.Office.Interop.Excel
Assembly Version: 12.0.0.0
Win32 Version: 12.0.4518.1014
CodeBase: file:///C:/engplan/template%20selection/Microsoft.Office.Interop.Excel.DLL
----------------------------------------
ADODB
Assembly Version: 7.0.3300.0
Win32 Version: 7.10.3077
CodeBase: file:///C:/Windows/assembly/GAC/ADODB/7.0.3300.0__b03f5f7f11d50a3a/ADODB.dll
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
You say the application is calling Excel 2003, but the loaded assembly is Excel 2007 (Assembly Version: 12.0.0.0, Win32 Version: 12.0.4518.1014 is Excel 2007 I believe).

The problem may be that the user has Excel 2007 installed instead of Excel 2003.

As one work-around, you can use late binding to handle different versions of Excel.
 

babsjoy

New member
Joined
May 16, 2012
Messages
2
Programming Experience
10+
Thanks for replying.. I have checked and the users I am deploying the application to, they have MS Office 2003 since the company has not yet upgraded to MS OFFICE 2010 (they are skipping Office2007) but I converted the application from VB.NET 2005/ XP to Vb.net 2008/Windows 7. Development machine has MS Office 2010, its a test machine for OFFICE 2010. I will double check the added reference assembly version to make sure I am using assembly verison 11.0 for MS2003. I see from the above output it is looking for Verison 12.0. My only question is if this was the root of the problem wouldn't all the users I deployed the application to be getting this error? At least 8+ people have deployed this application and only 1 person has reported this problem with the applcation. so ....
I am thinking something is missing on this 1 machine??? Is it the .dll if so I can add it to the .msi set up file application folder right? Just have to make sure its the right verison ??? thanks for your help and any ideas to help me resolve this issue...
Could you explain what late binding is too so that I can research... this may help when the company does upgrade to Office 2010.
 
Top Bottom