Skip to Content
avatar image
Former Member

Connecting Excel 2010 and SAP (on Windows 64Bit)

Dear all,

I have an excel macro, that connects to SAP (and executes transaction SOLAR01).

This macro is running in Excel 2010 and was all OK, until I received a new PC, now with Windows 7, 64 Bit.

Now the connection to SAP is not created anymore.

Error message is:

"Run-Time Error 614: The enumerator of the collection cannot find en element with the specified index"

This is the code snippet with the error:

Sub ErstelleSolar01()

Dim application As Object
Dim sapguiauto As Object
Dim connection As Object
Dim session As Object

Set sapguiauto = GetObject("SAPGUI")
Set application = sapguiauto.GetScriptingEngine
Set connection = application.Children(0)
Set session = connection.Children(0)


session.findById("wnd[0]").maximize                            

session.findById("wnd[0]/tbar[0]/okcd").text = "/nsolar01"      'Aufruf der Transaktion
session.findById("wnd[0]").sendVKey 0

....

....

End Sub

The red part is causing the error. The Children-enumeration is of size 0. As well as the session enumeration.

Therefore, I cannot get the session and go on in the code.

According to the documentation and as previous experience showed, it worked fine on Windows 7 (32 Bit).

In Windows 7 (64 Bit) it is not possible?!

I read somewhere, that the 64 Bit are the root cause for the issue.

Does anyone have an idea, how to get the session-enumeration in Windows 7, 64 Bit??

Thanks,

Jan

PS:  I checked the following solution without success: http://scn.sap.com/thread/2090988.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 21, 2013 at 02:54 PM

    The solution turned out to be quite easy and is not related to windows.

    After a restart of the system, a parameter was not correct.

    The profile parameter sapgui/user_scripting must be set to “TRUE” --> enabling scripting.😀

    Jan

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 19, 2013 at 02:50 PM

    I have the same problem trying to establish a connection, but this is an intermittent problem.  I have 3 SAP environment: Develop, Quality and Production.  They are theoretically equal but this the error began to occuronly only in Quality, for this I supposed there must exist any detail in SAP configuration that must be reviewed..

    Add comment
    10|10000 characters needed characters exceeded