excel VBA连接到SAP GUI,但不连接到SAP NW Business Client 5

kkbh8khc  于 2023-06-25  发布在  其他
关注(0)|答案(1)|浏览(100)

我使用以下代码行将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 GUI:

SAP NW Business Client 5中的SAP GUI:

如何更改代码以使其适用于SAP GUI和SAP NW Business Client?

8yparm6h

8yparm6h1#

而不是Set SapGuiAuto = GetObject("SAPGUI")
我使用了Set SapGuiAuto = GetObject("SAPGUISERVER"),这使得我的代码在Neveawer上工作。

相关问题