In myproject, need use VBA to call SAP-BW BEX query in a big loop. some
query will potential pop up warning message, in this case, User need manual
click "OK" button on pop up warning message to make queries continue running.
The problem is, it's very time consuming job so that we usually start it
overnight. namely, it's no possible let user stay ahead minitor just do
stupid "OK" clicked.
I find a way to use VBA to simulate "enter" key press to elimilate
warning message. but I don't know how to count process running time which
isn't finished (Warning message handing on), any body can help me, thanks in
advance.

my purposed code as following

Public Declare Sub keybd_event Lib _
"user32" (ByVal bVk As Byte, ByVal Scan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)


Sub test()
Dim timeStart as double
Dim timeLast as double
Dim i as integer

for i = 0 to 100
timeStart = Timer
' ******* add time count process, pls help me
Call RunSAPBEXQuery(XX,XX,XX)
' if timeLast is large than 5 minites and query is not finished
Call keybd_event(13, 0, 0, 0) ' VBA simulate "Enter" key
press to elimilate Warning message
' end if
Next
End Sub