none
VB6 application get this error 'Run-time error -2147319779 (8002801d) automation error when it tries to create an Excel Workbook RRS feed

  • Question

  • Hi. I get the Run-time error  -2147319779 (8002801d) automation error Application-defined or Object-defined error in a VB6 application when it tries to create an Excel Workbook. The application works fine in a Pc with Windows 7 and office 2007 (Excel 2007), but if fails in a machine with Windows 10 and office 2007. I was running the application as Administrator and i was disable the UAC as suggest in some forums, but it doesn't work. Do you have any other idea? Thank you in advance.
    Thursday, November 21, 2019 9:02 PM

Answers

  • To:  Peter Thornton
    re:  application version

    Thank you for the information on version differences.

    FWIW, one can specify the Excel app version using CreateObject with...
        Dim xlApp As Object
        Dim xlWB As Object
        Set xlApp = VBA.CreateObject("Excel.Application.12")
        xlApp.Visible = True
        Set xlWB = xlApp.Workbooks.Add

    • Marked as answer by Mike_mex Friday, December 13, 2019 9:35 PM
    Friday, November 22, 2019 8:24 PM

All replies

  • To:  Mike_mex
    re:  error in code

    You should post your code.

    FWIW:
    I believe MS has programed Windows 10 to push older Office users to rent Office 365.
    Just posted: 
    https://answers.microsoft.com/en-us/msoffice/forum/all/some-excel-files-messed-up-after-windows-upgrade/5b43956f-1e44-45f9-b1b1-435d65c33929


    Friday, November 22, 2019 1:18 AM
  • Hi. This is my code:

                

    Dim miexcel As Object
                    Dim wb As Workbook
                    Dim ws As Worksheet
                    Dim barre As Recordset

                    Set miexcel = CreateObject("excel.application")
                    miexcel.Visible = True
                    Set wb = miexcel.Workbooks.Add

    The application get the error in the last code line.

    Thank you in advance.

    Friday, November 22, 2019 6:15 PM
  • To: Mike_mex
    re:  code error

    Your code would not run as it would not compile; throwing an exception to the barre declaration.
    XL 2010 help says a RecordSet object is a property of a PivotCache and needs a PivotCache qualifier.
    I changed the declaration to: Dim barre as Object and the code ran successfully.
    '---

    Some new and some older Excel programs (now free) at MediaFire...
    Download from...
    http://www.mediafire.com/folder/lto3hbhyq0hcf/Documents

    Friday, November 22, 2019 6:59 PM
  • @ Nothing Left to Lose

    From the code snippet the Recordset declaration is in the VB6 app, presumably with a reference to DAO and of itself would not relate to the automation error (though would need to be a ref to a DAO version that exists in the system)

    @ Mike_mex

    You've got miexcel declared as Object (late binding), but the the Workbook and Worksheet references are fully declared and early binding, unusual to mix like this.

    Presumably you've got a reference to Excel. If it was set in a different system and to a later version than 12 (Excel 2010 or later) change it to the lowest version that will be used in any system. If that's not possible change all Excel related references to As Object and any xl named constants to their intrinsic values, and remove the Excel reference.

    If your reference is already to Excel 12.0, and as you say it works fine in Win7 I guess it may be, try the same code with same references in say Word in the problematic system.

    Friday, November 22, 2019 7:49 PM
    Moderator
  • To:  Peter Thornton
    re:  application version

    Thank you for the information on version differences.

    FWIW, one can specify the Excel app version using CreateObject with...
        Dim xlApp As Object
        Dim xlWB As Object
        Set xlApp = VBA.CreateObject("Excel.Application.12")
        xlApp.Visible = True
        Set xlWB = xlApp.Workbooks.Add

    • Marked as answer by Mike_mex Friday, December 13, 2019 9:35 PM
    Friday, November 22, 2019 8:24 PM
  • Hi. Thank you Nothing Left to Lose, it works perfectly !
    Friday, December 13, 2019 9:57 PM