龙空技术网

如何在Excel VBA中使用SAP脚本

Excel工作应用集 369

前言:

当前各位老铁们对“vb调用vbs脚本”大概比较注意,你们都需要剖析一些“vb调用vbs脚本”的相关文章。那么小编在网摘上汇集了一些对于“vb调用vbs脚本””的相关内容,希望姐妹们能喜欢,兄弟们一起来学习一下吧!

如何在Excel VBA中使用SAP脚本

在Excel VBA中,如何需要调用SAP,先使用以下代码创建连接。

如果没有强制申明变量的话,可以缩减成四句代码,它与VBS脚本中的代码的区别在于Application和Connection前多了一个SAP.

Set SapGuiAuto = GetObject("SAPGUI") 'Get the SAP GUI Scripting object

Set SapApplication = SapGuiAuto.GetScriptingEngine 'Get the currently running SAP GUI

Set SapConnection = SapApplication.Children(0) 'Get the first system that is currently

Set session = SapConnection.Children(0) 'Get the first session (window) on that connection

这些代码是必须的,如果要调用SAP的话。

标签: #vb调用vbs脚本