How to count process running time ( process not finished)

M

miao jie

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
 
G

gocush

If you just want to avoid the Alert dialog, try

Application.DisplayAlerts=False
before starting the the query

This will not provide any Time but keeps the code running
 
M

miao jie

no, Application.DisplayAlerts=False just forbit Excel pop up Alert dialog.
but unfortunityly, in my case the Alert dislog pop up by SAP Query, not the
Excel.

how to solve it??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top