VBA 连接到 SAP GUI,但未连接到 SAP NW Business Client 5
VBA connects to the SAP GUI, but not to SAP NW Business Client 5
我使用以下代码行将 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 图形用户界面:
SAP NW Business Client 5 中的 SAP GUI:
如何更改代码以使其同时适用于 SAP GUI 和 SAP NW 业务客户端?
而不是
Set SapGuiAuto = GetObject("SAPGUI")
我用了
Set SapGuiAuto = GetObject("SAPGUISERVER")
这使我的代码可以在 Neveawer 上运行。
我使用以下代码行将 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 图形用户界面:
SAP NW Business Client 5 中的 SAP GUI:
如何更改代码以使其同时适用于 SAP GUI 和 SAP NW 业务客户端?
而不是
Set SapGuiAuto = GetObject("SAPGUI")
我用了
Set SapGuiAuto = GetObject("SAPGUISERVER")
这使我的代码可以在 Neveawer 上运行。