1
votes

I use following lines of code to connect VBA to a SAP GUI session and it works well:

Sub Change_date()

Dim SapGuiAuto
Dim SetApp
Dim Connection
Dim Session

Set SapGuiAuto = GetObject("SAPGUI")
Set SetApp = SapGuiAuto.GetScriptingEngine
Set Connection = SetApp.Children(0)
Set Session = Connection.Children(0)
'And so on.

However this doesn't work in the SAP GUI inside SAP NetWeaver Business Client 5.

SAP GUI: SAP GUI

SAP GUI inside SAP NW Business Client 5: SAP GUI inside SAP NW Business Client 5

How do I change the code to make it suitable for both SAP GUI and the SAP NW Business Client?

1

1 Answers

1
votes

Instead of Set SapGuiAuto = GetObject("SAPGUI")
I used Set SapGuiAuto = GetObject("SAPGUISERVER") And this made my code work on Neveawer.