none
VBA Excel Interface Not Registered - Runtime Error '-2147221163 (80040155)' RRS feed

  • Question

  • Hello Everyone,

    This is a recent problem that just appeared this morning. The code is a VBA macro (not VB.Net) from Solidworks (CAD software) that opens and reads an Excel sheet before returning back to Solidowrks. It's currently running fine on two other network computers, and was running fine on this one until this morning. Operating system is Windows 10.

    Here is a snippet of the code: (error occurs on line three)

    Dim xlApp As Excel.Application
    Dim xlWB As Excel.Workbook

    Sub main()

        Set swApp = Application.SldWorks
        Set swModel = swApp.ActiveDoc

        Set xlApp = New Excel.Application
        xlApp.Visible = False

    Using this code for late-binding does not work either, however this brings up an ActiveX error.

    Dim xlApp As Excel.Application
    Dim xlWB As Excel.Workbook

    Sub main()

        Set swApp = Application.SldWorks
        Set swModel = swApp.ActiveDoc

        Set xlApp = CreateObject("Excel.Application")
        xlApp.Visible = False

    This brings up an error "ActiveX cannot create object."

    I've tried with different object libraries. The standard throughout the workplace is the Excel 14.0 object library. (Computer is currently running Excel 2019). I've tried with the Excel 16.0 object library and it made no difference.

    Any thoughts on where this problem could be coming from? I know it's not code specific, since it works elsewhere. I'm curious whether there is a better way to reference the excel object library that would be more robust? Or possibly something in the background has been updated and accidentally unregistered/deleted something. I tried going through the registry but without specific direction it was useless.

    Thanks in advance.

    Note, I did originally post this in the VB.Net section by mistake, so I've re-posted it here and removed that thread.


    • Edited by Taylor_L Wednesday, January 8, 2020 8:32 PM
    Wednesday, January 8, 2020 8:32 PM

All replies

  • To:  Taylor_L

    I am running xl2010 and the following references are checkmarked...

     Visual Basic for Applications
     OLE Automation
     Microsoft Excel14.0 Object Library
     Microsoft Office14.0 Object Library

    Your would need the equivalent
    '---
    NLtL

    Excel programs (now free) at MediaFire...
    The Custom_Functions add-in has 20 new Excel functions including the X_vLookUp function
    (multiple item return, use any column, optional 2nd item lookup)
    (no ads when downloading)

    Download from... 
    http://www.mediafire.com/folder/lto3hbhyq0hcf/Documents 

    Thursday, January 9, 2020 2:23 PM
  • I am running Windows 10 and Office 2019. Do you know where those object libraries are located? Google returns various results with no success.

    Thursday, January 9, 2020 6:32 PM
  • To:  Taylor_L
    re:  where are the files located

    I am still on Windows XP with IE blocked off from the web, using a partitioned disc.
    So the locations may not be much help.
    But if you are in the VBE using Tools | References, the desired references should appear in the list?
    But, if you are using the "rental" Office version, then ???

    '---
    Visual Basic for Applications...
    C:\Program Files\Common Files\Microsoft Shared\VBA\VBA7

    Microsoft Excel 14.0 Object Library...
    E:\Office14\Excel.EXE

    OLE Automation...
    C:\WINDOWS\system32\stdole32.tlb

    Microsoft Office 14.0 Object Library
    C:\Program Files\Common Files\Microsoft Shared\OFFICE14

    Thursday, January 9, 2020 7:50 PM
  • I have selected all of those to no avail. If I try to direct it to Excel2019.exe it says error loading DLL.
    Friday, January 10, 2020 3:59 PM
  • To:  Taylor_L

    Out of ideas, you may have to reinstall Excel.
    First, you should ask Solidworks about the issue.
    Friday, January 10, 2020 4:16 PM