![]() |
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 . I made the changes and the code ran. I made additions over several weks and the code still ran . I did not run the code a gain for about a month and then the code would not run on the Vista machine so I installed VS2005 on an XPpro PC and the same then code compiiles 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 Visaul 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\Sc heduler.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.ge t_Workbooks() at ShowTimeScheduler.ShowTimeDirector..ctor() in C:\ShowTimeScheduler\Backup\ShowTimeDirector.vb:li ne 2222 Error occurs at the line : Dim ExcelWB As Excel.Workbook = ExcelScheduler.Workbooks.Open("C:\ExactaRecords\Sc heduler.xls") Does any one have any ideas how to fix this problem? Thanks |
All times are GMT +1. The time now is 01:44 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com