Skip to Content

Run-time error '-2147221020 ( 800401e4)'

Hello Community,

I want to read out data from SAP through Excel with scripting. I found the following Code but it only runs on Windows and when I try to run it on Mac I get this Run-time error

Run-time error '-2147221020 ( 800401e4)' Automation error.

Many thanks in advance.

Sub Claim()


If Not IsObject(Sap_application) Then
           Set SapGuiAuto = GetObject("SAPGUI")
           Set Sap_application = SapGuiAuto.GetScriptingEngine
        End If
        If Not IsObject(Connection) Then
           Set Connection = Sap_application.Children(0)
        End If
        If Not IsObject(session) Then
           Set session = Connection.Children(0)
        End If
        If IsObject(WScript) Then
           WScript.ConnectObject session, "on"
           WScript.ConnectObject Sap_application, "on"
        End If
 End Sub

This is the error what it throws

and when I play Debug it shows me this in highlighted

when I click "step over" or "step into" it shows me the same Run-time error!

What can I do in this case.

Office Excel Version

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Aug 11, 2018 at 02:49 PM

    Hello Rafael,

    welcome in the SAP Community.

    I don't use Mac but I assume, if you execute Excel native in the Mac OS X, it doesn't support COM respectively ActiveX. You could execute your Excel and SAP GUI for Windows inside a virtual Windows environment on your Mac to satisfy your requirements.

    Best regards
    Stefan

    Add comment
    10|10000 characters needed characters exceeded