I'm making a vba code to import my data from SAP GUI I was wondering, how to do a loop that "clicks OK" when SAP tells
No data has been selected
this means that for this year for example no data has been entered in sap for a given transaction.
Public Sub RunGUIScript()
Dim W_Ret As Boolean
Dim Société As String
Sheets("Extraction").Select
Société = Range("b9")
' Connect to SAP
W_Ret = Attach_Session
If Not W_Ret Then
Exit Sub
End If
On Error GoTo myerr
[script SAP]
Exit Sub
myerr:
MsgBox "Error occured while retrieving data", vbCritical + vbOKOnly
End Sub
When there is this error message I want SAP to "click OK" and delete what is in its memory (I paste data from a "temp" sheet to my table)