英文:
How to get text from status bar in SAP GUI
问题
我试图在SAP GUI中自动化一个特定的过程。但我无法编写脚本来处理这个特定的部分。
它会读取,直到我在绿色显示的字段上双击。
之后会打开以下窗口:
我如何在VBA中获取这个数字?有什么想法吗?
英文:
I'm tying to automate a certain process in SAP GUI. But I can't get the script this specific part.
It reads until I double click in this field shown in color green.
After that the following window is opened:
How do I get this number in VBA? Any ideas?
答案1
得分: 3
这段代码在Excel VBA中应该在任何地方都能运行(docNumber 是你的结果):
Dim objRegEx As Object
Dim theMatches As Object
Dim statusPanel As String
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.IgnoreCase = True
objRegEx.Global = True
objRegEx.Pattern = "[^\D]+"
statusPanel = session.FindById("wnd[0]/sbar/pane[0]").Text
Set theMatches = objRegEx.Execute(statusPanel)
For Each Match In theMatches
docNumber = Match.Value
Next
英文:
This should work everywhere in Excel VBA(docNumber is your result):
Dim objRegEx As Object
Dim theMatches As Object
Dim statusPanel As String
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.IgnoreCase = True
objRegEx.Global = True
objRegEx.Pattern = "[^\D]+"
statusPanel = session.FindById("wnd[0]/sbar/pane[0]").Text
Set theMatches = objRegEx.Execute(statusPanel)
For Each Match In theMatches
docNumber = Match.Value
Next
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论