Skip to Content

Connection to SAP from Excel

Hi Guys,

I am trying to connect to SAP from Excel. I have this bit of code in my macro:

Sub SAPConnect()

Dim sap

Set sap = CreateObject("SAP.Functions")

sap.Connection.User = "user"

sap.Connection.Password = "password"

sap.Connection.Client = "xxx"

sap.Connection.Systemnumber = "xx"

sap.Connection.System = "xxx"

sap.Connection.ApplicationServer = "xxxx"

sap.Connection.Language = "EN"

sap.Connection.GroupName = "xxxx"

sap.Connection.MessageServer = "xxxxxx"

Unfortunately I am not able to connect at all.

I get a run-time error "1001" Failed to return dispatch object right after Set sap = CreateObject("SAP.Functions")

I have searched the web a lot and most of the macros I could find use similar code for the connection.

This code used to work on SAP GUI 6.40 it stopped working as soon as my GUI was updated to 7.20.

Any ideas on how I need to modify the code?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Dec 02, 2011 at 05:01 PM

    Hi Rafal,

    I can recommend the following link; sap-crm-vba-excel-macro-no-data-return



    Add comment
    10|10000 characters needed characters exceeded

    • Hi Scriptman,

      Problem solved !

      As it appears wdtlog.ocx file was missing from c:\Program Files\Common Files\SAP Shared\

      Once I copied it there from a different machine and registered it everything started working 😊

      Thanks again for all your help.

  • avatar image
    Former Member
    Jan 23, 2013 at 04:51 AM

    Hello Scriptman,

    In my company we have to timesheet on weekly basis and we have to maintain a separate data in excel. for which i am exporting a lot data from SAP timesheet fro different people and then i ll have to match all the data.
    for simplification i have created one excel file where we are filling the same data as SAP timesheet. but at the end of every month we again have to cross check for mismatches in two data.

    Now i want to link SAP data with my excel so that mismatch will not occur.


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 16, 2013 at 11:58 AM

    Hello All,

    I was asked if I can integrate Excel to our SAP BI tools for our ad hoc reporting. One question, is there an interface license fee in order to connect to SAP?

    Thank in advance!


    Add comment
    10|10000 characters needed characters exceeded