最初的问题在最下面
更新:
下面是我目前正在处理的内容,但是它给了我错误619,因为当找不到通知号时,SAP不会返回数据。
Sub QM03()
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启动事务以查看表session.StartTransaction "QM03“
Dim rngNotificationNumbers As Range
Set rngNotificationNumbers = Range("A4:A704")
Dim arrNotificationNumbers(700) As String
Dim cell As Range
Dim i As Long
i = 0
For i = 0 To UBound(arrNotificationNumbers) - 1
session.FindById("wnd[0]/usr/ctxtRIWO00-QM03").Text = arrNotificationNumbers(i)
session.FindById("wnd[0]").SendVKey 0
StatusBarText = session.FindById("wnd[0]/sbar/pane[0]").Text
If InStr(StatusBarText, " does not exist") Then
GoTo NextIteration
End If
NextIteration:
Next
End Sub`
*我是SAP和VBA的新手,但我真的需要一些帮助!
我试图从excel表中获取通知号,并将其输入到QM03中,然后转到“Items”,将“缺陷类型”输出到excel,然后转到带有任务代码P020的行中的“Item task”,并将“Text”输出到excel。
如果找不到通知号,我想跳过它,转到下一个。
我正在使用用于Windows的SAP。
我真的很感激你的帮助!谢谢!*
发布于 2018-06-07 15:04:03
而不是
If InStr(StatusBarText, " does not exist") Then
GoTo NextIteration
End If
NextIteration:做这样的事
If InStr(StatusBarText, " does not exist") Then
' Do nothing
else
' Do your stuff here
End If并移除标签NextIteration:
你似乎错过了基本的编程知识,所以你可以看看这里或其他初学者的网站。
https://stackoverflow.com/questions/50728470
复制相似问题