How to suspend execution of code in VBA?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
In VBA for Excel there is something like Application.Wait to suspend
execution for some time.
But how to achieve this in Access 2003?
 
No idea if there is such a function available in MS Access but you can
allways use the following code which is all VBA so could conceivably be used
in all Office Automation tasks:

Sub PauseExecution(ByVal pauseTimeSeconds As Long, ByVal freeze As Boolean)

Dim pauseStartTime as Date

pauseStartTime = Date()
Do While Seconds(Date() - pauseStartTime) < pauseTimeSeconds
If Not freeze Then DoEvents
Loop

End Sub

You can use this sub to halt execution for pauseTimeSeconds seconds and you
can make the application 100% unresponsive with freeze = True (wouldn't
recommend it) or respond to events using freeze = false.
Let me know if this works for you.


"hstijnen" schreef:
 
Back
Top