I have been trying to extract a database from SAP via Excel VBA using the following code:
Public SapGuiAuto, WScript, msgcol
Public objGui As GuiApplication
Public objConn As GuiConnection
Public session As GuiSession
Set SapGuiAuto = GetObject("SAPGUI")
Set objGui = SapGuiAuto.GetScriptingEngine
Set objConn = objGui.Children(0)
Set session = objConn.Children(0)
'Insert your SAP Script here
MsgBox "The file is updated"
The database extraction is not included yet, however, since that part will not be too difficult using SAP script recording. Unfortunately, this code above (which I got from a standard template found on Google and it worked for other people) returns the following error:Run-time error '-2147221020 (800401e4)':Automation errorInvalid syntax.If I debug the error, it highlights the first rule after starting the Sub.I think it has something to do with me running SAP through Citrix, but I do not know how to adapt the code correctly... Can somebody help me or share a link to a template that is connecting Excel VBA to SAP via Citrix? It would be much appreciated!