VBA 中的 SAP GUI 脚本 "Invalid use of property" 错误

SAP GUI Scripting "Invalid use of property" Error in VBA

您好,我正在使用 SAP GUI 脚本工具,它使用 Excel VBA 功能来完成任务。我在 Set Application = SapGuiAuto.GetScriptingEngine 代码行得到 Invalid use of property

If Not IsObject(Application) Then
   Set SapGuiAuto = GetObject("SAPGUI")
   Set Application = SapGuiAuto.GetScriptingEngine

为什么会出现此错误?

我建议您将变量 Application 重命名为其他名称。

Application在这里像变量一样使用,但在Excel.

中也是预定义的只读对象