Search code examples
vbasap-gui

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


Hello I am using SAP GUI Scripting tool which uses Excel VBA functionality to complete the task. I am getting Invalid use of property at Set Application = SapGuiAuto.GetScriptingEngine line of code:

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

Why do I get this error?


Solution

  • I suggest you to rename the variable Application to another name.

    Application is here used like a variable, but it is also a pre-defined read-only object in Excel.