SAP更新到7.4-VBA无法连接到SAPGUI

时间:2018-06-20 17:02:22

标签: excel vba excel-vba sap sap-gui

所以几个月前我在SAP 7.3上做了一些宏,但是我公司最近要求所有人都更新到SAP 7.4。我的宏都无法正常工作了,因为它在连接到SAPGUI时出现了某种问题。

到目前为止,我一直使用此代码将excel连接到SAP

Set SapGuiAuto = GetObject("SAPGUI")  'Get the SAP GUI Scripting object
  Set SAPApp = SapGuiAuto.GetScriptingEngine 'Get the currently running SAP GUI
  Set SAPCon = SAPApp.Children(0) 'Get the first system that is currently connected
  Set session = SAPCon.Children(0) 'Get the first session (window) on that connection

但是现在我在第一行之后收到错误:'-2147221020(800401e4)' 这是自动化错误和无效的语法。

有人知道我可以如何更新工作表来解决此问题?

1 个答案:

答案 0 :(得分:1)

好的,重新安装SAP后,我得到了标准的SAP登录板和更新的SAP业务客户端。该界面在业务客户端中看起来有所不同,但仍包含脚本记录。我记录并注意到

Set SapGuiAuto = GetObject("SAPGUI")

现在是

Set SapGuiAuto = GetObject("SAPGUISERVER")

这与将我从7.3升级到7.4之前的操作一样,可以正确地重新连接到SAP。如果出于某种原因使用登录板,它仍然无法连接,但这总比没有好。基本上相同,只是外观不同。

相关问题