Search code examples
vbscriptautodesksap-gui

application.Children is an empty list while using SAP GUI with VBScript:


The enumerator of the collection cannot find en element with the specified index.

I get the above error on line number of 3 of the following code:

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

How to check size of application.Children?


Solution

  • Probably the SAP (SAP Logon/SAP GUI) are not open.

    But if you want, try:

    ChildCount = application.Children.Count