I have an error
Run-Time error '-2147417856 (80010100)': Method 'Text' of object 'ISAPTextFieldTarget' failed
on below line which I have totally no clue why the error happened. The problem is, sometimes this error appears and sometimes not.
cell2 is where the value of the cell for example :
session.findById("wnd[0]/usr/sub:SAPMF05A:0731/txtRF05A-SEL01[0,0]").Text = cell2
since the full code is very long, I will include part of it that triggered the error.
If session.findById("wnd[0]/sbar").Text = "Check - document date is in the future" Then
session.findById("wnd[0]").sendVKey 0
End If
session.findById("wnd[0]").sendVKey 0
'First cell you want to copy to SAP. You can use Range("D6") if that will always be the first cell:
Set rFirst = Range("H" & ActiveCell.Row)
'Last cell you want to copy to SAP 'This code will go to the last cell in column D:
Set rLast = Range("H" & ActiveSheet.Rows.Count).End(xlUp)
'All the cells between the first and last cell. This is now a range you can loop through.
Set rSource = Range(rFirst, rLast)
For Each cell2 In rSource
session.findById("wnd[0]/usr/sub:SAPMF05A:0731/txtRF05A-SEL01[0,0]").Text = cell2
session.findById("wnd[0]").sendVKey 0
'Run FB03 in new sap screen, number 2 or any active 2nd screen
If session.findById("wnd[0]/sbar").Text = "No appropriate line item is contained in this document" Then
'continue next code
I provide the picture of the error as per below. The thing is if i click debug, and click resume. It will continue to proceed like nothing is error.