如何在 SAP GUI 中创建暂停?
How to create a pause in SAP GUI?
通过 Excel 连接到 SAP GUI 后,我在从 SAP GUI 获取数据时遇到问题。
宏太快了。如果暂停,则逻辑有效,但不暂停,则无效。
我想在 SAP GUI 中包含 运行 的时间。
Sub Sap()
Dim Application, SapGuiAuto, Connection, session, WScrip
If Not IsObject(Application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set Application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(Connection) Then
Set Connection = Application.Children(0)
End If
If Not IsObject(session) Then
Set session = Connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject Application, "on"
End If
'Login
session.findbyid("wnd[0]").maximize
session.findbyid("wnd[0]/usr/txtRSYST-BNAME").Text = "mylogin"
session.findbyid("wnd[0]/usr/pwdRSYST-BCODE").Text = "password"
session.findbyid("wnd[0]/usr/pwdRSYST-BCODE").SetFocus
session.findbyid("wnd[0]/usr/pwdRSYST-BCODE").caretPosition = 8
session.findbyid("wnd[0]").sendVKey 0
'MM02
session.findbyid("wnd[0]/tbar[0]/okcd").Text = "mm02"
session.findbyid("wnd[0]").sendVKey 0
Application.Wait Now + TimeValue("00:00:03") '——->>>>> BUT NOT WORK THIS FUNCTION
'continueing…
End Sub
在VBA.
中还有另一种生成等待的方法
例如:
Sub Sap()
Dim Application, SapGuiAuto, Connection, session, WScript
set wshell = CreateObject("Wscript.Shell")
...
wshell.run "c:\tmp\sleep_3000.vbs",1,true
'continueing…
End Sub
sleep_3000.vbs 在 c:\tmp
wscript.sleep 3000
问候,ScriptMan
通过 Excel 连接到 SAP GUI 后,我在从 SAP GUI 获取数据时遇到问题。
宏太快了。如果暂停,则逻辑有效,但不暂停,则无效。
我想在 SAP GUI 中包含 运行 的时间。
Sub Sap()
Dim Application, SapGuiAuto, Connection, session, WScrip
If Not IsObject(Application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set Application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(Connection) Then
Set Connection = Application.Children(0)
End If
If Not IsObject(session) Then
Set session = Connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject Application, "on"
End If
'Login
session.findbyid("wnd[0]").maximize
session.findbyid("wnd[0]/usr/txtRSYST-BNAME").Text = "mylogin"
session.findbyid("wnd[0]/usr/pwdRSYST-BCODE").Text = "password"
session.findbyid("wnd[0]/usr/pwdRSYST-BCODE").SetFocus
session.findbyid("wnd[0]/usr/pwdRSYST-BCODE").caretPosition = 8
session.findbyid("wnd[0]").sendVKey 0
'MM02
session.findbyid("wnd[0]/tbar[0]/okcd").Text = "mm02"
session.findbyid("wnd[0]").sendVKey 0
Application.Wait Now + TimeValue("00:00:03") '——->>>>> BUT NOT WORK THIS FUNCTION
'continueing…
End Sub
在VBA.
中还有另一种生成等待的方法例如:
Sub Sap()
Dim Application, SapGuiAuto, Connection, session, WScript
set wshell = CreateObject("Wscript.Shell")
...
wshell.run "c:\tmp\sleep_3000.vbs",1,true
'continueing…
End Sub
sleep_3000.vbs 在 c:\tmp
wscript.sleep 3000
问候,ScriptMan