Skip to Content
Former Member
Aug 21, 2015 at 09:02 PM

VBA and SAP Logon pad


Hi, I am new to SAP. I have the SAP Logon 740 screen up and need to bind Excel VBA so I can choose which logon to pick and open SAP. My goal is to choose one of my favorites and export some data. My code fails at ...

Set SapGuiAuto = GetObject("SAPGUI") with the error "Automation Error Invalid Syntax".

I have my reference "SAP Remote Function Call Unicode Control" and "SAP GUI Scripting API" added. I connect through Citrix, not sure if that matters.

Sub Test()

Dim SapGuiAuto As Object

Dim Application As SAPFEWSELib.GuiApplication

Dim Connection As SAPFEWSELib.GuiConnection

Dim Session As SAPFEWSELib.GuiSession

Dim Window As SAPFEWSELib.GuiModalWindow

Dim Coll As SAPFEWSELib.GuiCollection

Set SapGuiAuto = GetObject("SAPGUI")

If Not IsObject(SapGuiAuto) Then

Exit Sub

End If


Another option could be login scripts:

I have seen logon scripts, but I don't know where to get all the details...

sapConnection.client = "xxx"

sapConnection.user = "know this"

sapConnection.Language = "EN"

sapConnection.hostname = "xxx"

sapConnection.Password = "know this"

sapConnection.SystemNumber = "x"

sapConnection.Destination = "xxx"


I can see the properties from my connection type,

I have systemId, Message Server, Group/Server, InstanceNumber

I am also trying to get Script Recording and Playback activated, that may not happen.

Any help appreciated.