3

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?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
user SG
  • 33
  • 1
  • 4
  • Not sure, but if `Application` is not an object, you can't use the `Set` keywaord for assignment. – Paul Ogilvie Mar 19 '16 at 10:23
  • How is Application declared? If this is running in Excel VBA then VBA is going to interpret Application, with no declaration, as the Excel application. That would certainly not be correct. Beyond that, is the sytax on the right side of the equation correct? GetScriptingEngine sounds like a method, what does it return? Does it return, or is it expecting a ByRef parameter? You're also missing relevant tags that would make this visible to people who know something about the SAP Scripting tool... – Cindy Meister Mar 19 '16 at 11:59
  • Thanks . The issue was resolved by renaming the variable Application as Sapplication. – user SG Mar 20 '16 at 19:26

1 Answers1

3

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.

SQL Police
  • 4,127
  • 1
  • 25
  • 54