none
[VB.Net] HRESULT : 0x80040154 (REGDB_E_CLASSNOTREG), help please? RRS feed

  • Question

  • Hello everybody,

    So I'm programming in VB.Net and on my code, I have to cast an Excel Workbook, but when I do that, I got an Error and I don't know how to resolve it.

    I tried 2 solutions I found on this site: Site so I passed my platform project on x86 and  installed the add-in COM of office.

    But none of those solutions worked, what can I do then?

    Example of my code use:

                doc = New Excel.Workbook
            racine = doc.UsedRange
            racine2 = racine.Columns
            If (extxext <> "") Then
                extxexts = racine2.Item(12)
            Else
                extxexts = racine2.Item(9)
            End If

    Best regards


    Wednesday, July 27, 2016 1:43 PM

Answers

  • Hi,

     

    If you want to add a new workbook using Excel automation, get the excel application, then add the new.

    Try  Application.Workbooks.Add()  instead of  New Excel.Workbook

     

    Dim xlapp As Excel.Application

    Dim doc As Excel.Workbook

    xlapp = CreateObject("Excel.Application")

    xlapp.Visible = True

    doc = xlapp.Application.Workbooks.Add()


    Thursday, July 28, 2016 5:19 AM
    Moderator