Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_



  • 1. Excel 2007 VBA How can I install my spreadsheet in a user dire
    Is there some standard, existing software that will install my program from CD to the user's hard drive? -- TomThumb "NickHK" wrote: > Not sure what you are asking... > > - You want an Installer to copy a specific Excel file to a specific location > ? > Plenty of installers available, Inno etc > - You want to allow the user to select a file: > Application.GetOpenFileName > > NickHK > > "TomThumb" < XXXX@XXXXX.COM > wrote in message > news: XXXX@XXXXX.COM ... > > Is there a generic program that will autoexecute and load my spreadsheet > into > > a user directory, offering the user an opportunity to browse their hard > drive? > > -- > > TomThumb > > >
  • 2. Macro to select "last used column + 1"
    Hello, Is there a simple macro to select column C till the last one + 1 column extra. For example.... I used column C till K, so... I want to select C till L (one more than the last one used). regards, Johan
  • 3. Collapsing rows
    I am writing categories of data (a category covers several rows) to an Excel sheet, one category after another. I would like to collapse the rows containing a category when all category data are entered. So the question is how to programmatically collapse a number of rows after filling them with data. Thanks
  • 4. Progressbar on userform for waiting querytable retrieving data from web
    Dear all, i'm getting crazy to understand how to show progress of querytables retrieving data from website. I tried userform show but it seems by this method i stop query working What I want to do is to show a progress bar on userform to count how many time do i need to wait till data retrieving from website by querytable many thanks for your precious help bye

Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_

Postby c2d0bQ » Wed, 07 May 2008 10:20:00 GMT

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 


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 = 

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 
       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 = 



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


Similar Threads:

1.Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))


I am working with a conversion application from VB 6.0 to VB.NET 2005.
I used Visual Studio 2005 for conversion of this VB 6.0 code. It's
sussfully converted And Working fine in some devlopment systems.  But
in few systems (like, my development PC) an AxComCtlLib.dll is missing
in Reference of .net Solutions automatically. I try to add
AxComCtlLib.dll from bin to Reference of .net Solutions. Now project
is Sucessfully compiling in my Development PC also and When I try to
run the application I am getting below error in the

Class not registered (Exception from HRESULT: 0x80040154

Can anybody suggest me with the solution for this. Its very urgent for
me. Please try to help me asap.
Thanks in advance.

2.Interface not registered (Exception from HRESULT: 0x80040155)

I am working in MS Office Accounting Express 2007 and MS Office Word 2003 and 
trying to either send a quote as an email or save as a Word document. This is 
when I am getting this error.

Is there a compatability issue with the Accounting software and this version 
of Word?

How can I get this fixed?
Eddi Rae

3.Exception from HRESULT: 0x800A03EC - COM Exception Unhandled


I am working on exporting data from a dataset to excel.  When I used save 
file dialog to save the file in a desired path I came across this Error.

Please find below the code I have used

using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;

	static class ExportingCellByCellMethod

        public static void ExportToExcel(DataSet dataSet, string outputPath)
       // public static void ExportToExcel(DataSet dataSet)

            // Create the Excel Application object
            ApplicationClass excelApp = new ApplicationClass();
            //excelApp.Interactive = false;
            // Create a new Excel Workbook
            Workbook excelWorkbook = excelApp.Workbooks.Add(Type.Missing);

            int sheetIndex = 0;

            // Copy each DataTable as a new Sheet
            foreach (System.Data.DataTable dt in dataSet.Tables)

                // Create a new Sheet
                Worksheet excelSheet = (Worksheet)excelWorkbook.Sheets.Add(
                    Type.Missing, 1, XlSheetType.xlWorksheet);
                excelSheet.Name = dt.TableName;               
                // Copy the column names (cell-by-cell)
                for (int col = 0; col < dt.Columns.Count; col++)
                    excelSheet.Cells[1, col + 1] = dt.Columns[col].ColumnName;

                    // Copy the values (cell-by-cell)
                    for (int col = 0; col < dt.Columns.Count; col++)
                        for (int row = 0; row < dt.Rows.Count; row++)
                            excelSheet.Cells[row + 2, col + 1] = 



                // Save and Close the Workbook
XlFileFormat.xlWorkbookNormal, Type.Missing,
                    Type.Missing, Type.Missing, Type.Missing, 
                    Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
                excelWorkbook.Close(true, Type.Missing, Type.Missing);  

                excelWorkbook = null;
                // Release the Application object
                excelApp = null;

                // Collect the unreferenced objects


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Configuration;

    public partial class Form1 : Form
        System.Data.OleDb.OleDbConnection conn;
        OleDbDataAdapter DA;
        string S;
        DataSet source;        

        public Form1()
            conn = new System.Data.OleDb.OleDbConnection();
            conn.ConnectionString = 

private DataSet getDemoDataSet()
            S = "Select Emp_ID as [ID], Emp_Name as NAME,Reason as REASON, 
            source = new DataSet();
            DA = new OleDbDataAdapter(S, conn);
            source.Tables[0].TableName = "sample";
            return source;

private void button2_Click(object sender, EventArgs e)
            DataSet demoDataSet = this.getDemoDataSet();
            string savepath;
            saveFileDialog1 = new SaveFileDialog();
            savepath = saveFileDialog1.FileName + ".xls";
            saveFileDialog1.Filter = "xls files (*.xls)|*.xls";
            if (saveFileDialog1.ShowDialog() == 
                && saveFileDialog1.FileName.Length > 0)

            MessageBox.Show("Data Exported successfully");                   


Can anyone help me out in solving this? Replies are highly appreciated. TIA.

4.Error 1911. Cannot register type library

Getting this error message when attempting to repair/reinstall Office 
Standard XP or Office Student and Teacher 2003.  This is only affecting Excel 
not anything else with the programs.  Microssoft tells me that I should go to 
their PAY site to get help on this since they do not support this anymore.

Have looked at all their kb info's but they all refer to other programs, 
and/or operating systems.  Running Windows XP sp2.

Any thoughts or suggestions would be greatly appreciated

5.Registered Type Libraries

I am writing a class that returns a list of all registered type
libraries on a computer.  Just by searching for the name of one of my
DLL's in the registry, i found where it stores all such information:

I then looked in a few of the entries just to get a sense of how it
works.  I understand all except the reason for the 2nd numbered

An example is:

  - 6.0           (visual basic for applications)
     - 9
        - win32   (C:\WINDOWS\System32\MSVBVM60.DLL)
     - FLAGS      (0)
     - HELPDIR    ()

In this example, i do not know what the "9" means.  For most typelibs,
this value is "0", although i have also seen "409".  What does this
number represent?

The primary reason of doing this is that I can then use the TLI classes
to extract other info from typelibs, including the expected name and
location of its help file.  This is important because whenever i do F1
to get help in VB, i always get a blank help screen because the file is
never in the right place.  so far, i have use this to correct at least
5 different typelibs, by searching my computer for a file with the same
name as what the typelib expects, and then copying it into the right
directory.  this has helped a lot, because now i can actually get
contextual help on ADO and DAO methods, among other things.

Secondary reasons include the ability to dynamically extract interface
definitions from typelibs for easy implementation in VB and help in
transferring references across sourcesafe using our own sourcesafe
integration with the VBA IDE (which we had to build since the one that
came with office developer sucks).

Anyway, if anyone has any ideas about any other information i can get
from the registry or any other possible applications of such a class,
please let me know.

6. Register Access type library - Vista x64

7. Error : 1911. Setup cannot register type library

8. Getting Object Library Not Registered - Microsoft Visual Basic

Return to MS EXCEL


Who is online

Users browsing this forum: No registered users and 5 guest