Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
tools
vsnet.act
vsnet.debugging
vsnet.documentation
vsnet.enterprise.tools
vsnet.general
vsnet.ide
vsnet.jlca
vsnet.servicepacks
vsnet.setup
vsnet.vsip
vsnet.vss
vsnet.vstools.office
vstudio.development
vstudio.extensibility
vstudio.general
vstudio.helpauthoring
vstudio.setup
vstudio.sourcesafe
  
 
date: Tue, 6 May 2008 16:07:00 -0700,    group: microsoft.public.vstudio.development        back       


Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_   
My current code ran in VS2003 on a XPpro machine. I transferred it to a Vista 
machine and had to purchase VS2005 (VS2003 not supported). I made the 
necessary changes and the code ran. I made additions to the code over several 
weks and the code still compiiled successfully . I did not run the code a 
gain for about a month and then the code would not compile on the Vista 
machine so I installed VS2005 on an XPpro PC and ran the same code, which 
failed on Vista and it compiled and runs fine. 
 

Both PCs have Ofiice 2003 Pro on them and no other versions of Excel or 
office.

It as if one of  the MS regular Vista updates made a change causing the code 
not to compile.

My code is in Visual Basic


These are the first lines of the code

 

Imports System.IO
Imports System.IO.StreamReader
Imports System
Imports System.Threading
Imports System.text.regularexpressions
Imports System.Text
Imports System.Globalization
Imports System.Collections
Imports Microsoft.Office.interop.excel
Imports Excel = Microsoft.Office.Interop.Excel
Imports System.Reflection
Imports System.Runtime.InteropServices

 

The lines following this are Windows Form Designer Generated code (about 
2000 of them ) Total program is about 9000 lines

 

Dim ExcelScheduler As New Excel.Application

Dim ExcelWB As Excel.Workbook = 
ExcelScheduler.Workbooks.Open("C:\ExactaRecords\Scheduler.xls")

Dim ScheduleSheet1 As Excel.Worksheet = ExcelWB.Sheets(1)
Dim ScheduleSheet2 As Excel.Worksheet = ExcelWB.Sheets(2)
Dim ScheduleSheet3 As Excel.Worksheet = ExcelWB.Sheets(3)

 
ScheduleSheet1 = ExcelWB.Worksheets(1)
ScheduleSheet2 = ExcelWB.Worksheets(2)
ScheduleSheet3 = ExcelWB.Worksheets(3)

 
This is the error message:


System.InvalidCastException occurred
  Message="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: 
Library not registered. (Exception from HRESULT: 0x8002801D 
(TYPE_E_LIBNOTREGISTERED))."
  Source="Microsoft.Office.Interop.Excel"
  StackTrace:
       at Microsoft.Office.Interop.Excel.ApplicationClass.get_Workbooks()
       at ShowTimeScheduler.ShowTimeDirector..ctor() in 
C:\ShowTimeScheduler\Backup\ShowTimeDirector.vb:line 2222


Error occurs at the line :

Dim ExcelWB As Excel.Workbook = 
ExcelScheduler.Workbooks.Open("C:\ExactaRecords\Scheduler.xls")

 I did try removing all references to 11.0 and tried earlier interops . I 
also cleaned the registry of all references to office and reinstalled office 
2003 Pro and VS 2005 to no effect.

I have also downloaded and reinstalled all the office PIAs 


Does any one have any ideas how to fix this problem?

Thanks
date: Tue, 6 May 2008 16:07:00 -0700   author:   sgtm

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us