Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Bryant Smith   on Jan 30 In MS Office Category.

  
Question Answered By: Herbert Weaver   on Jan 30

I have used this function between Access and Word to ensure that Access
has enough time  to push the information over to Word. You may be able
to modify it for your purposes:

Option Compare Database
Option Explicit
'***************** code  Start *******************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Sub sapiSleep Lib "kernel32" _
Alias "Sleep" _
(ByVal dwMilliseconds As Long)
Sub sSleep(lngMilliSec As Long)
If lngMilliSec > 0 Then
Call sapiSleep(lngMilliSec)
End If
End Sub

Sub sTestSleep()
Const cTIME = 1000 'in MilliSeconds
Call sSleep(cTIME)
MsgBox "Before this Msgbox, I was asleep for " _
& cTIME & " Milliseconds."
End Sub
'***************** Code End *********************

Another Option:
Here's a little function that uses the system Timer to wait  for a
specified length of time.

Public Sub Wait(dblTime As Double)

Dim dblT1 As Double
Dim dblT2 As Double

dblT1 = Timer()

Do Until dblT2 >= dblT1 + dblTime
dblT2 = Timer()
DoEvents
Loop

End Sub

Share: 

 
 
Didn't find what you were looking for? Find more on Timeouts/Crashes Or get search suggestion and latest updates.


Tagged: