Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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.

Former Member
Former Member replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question