我使用以下代码行将VBA连接到SAP GUI会话,并且效果很好:
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.
但是,这在SAP NetWeaver Business Client 5的SAP GUI中不起作用。
SAP NW Business Client 5中的SAP GUI:
如何更改代码使其适用于SAP GUI和SAP NW Business Client?
答案 0 :(得分:1)
代替
Set SapGuiAuto = GetObject("SAPGUI")
我用了
Set SapGuiAuto = GetObject("SAPGUISERVER")
这使我的代码在Neveawer上工作。