application.Children 在将 SAP GUI 与 VBScript 结合使用时是一个空列表:

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.

我在以下代码的第 3 行收到上述错误:

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

如何查看 application.Children 的大小?

可能 SAP(SAP Logon/SAP GUI)未打开。

但如果你愿意,试试:

ChildCount = application.Children.Count