davesmith202
Employee of Access World
- Local time
 - Today, 10:33
 
- Joined
 - Jul 20, 2001
 
- Messages
 - 522
 
How can I have a pause in my code for say half a second??
 
			
				Last edited: 
			
		
	
								
								
									
	
		
			
		
		
	
	
	
		
			
		
		
	
								
							
							Public Function Pause(NumberOfSeconds As Variant)
On Error GoTo Err_Pause
    
    Dim PauseTime As Variant, Start As Variant
    
    PauseTime = NumberOfSeconds
    Start = Timer
    Do While Timer < Start + PauseTime
    DoEvents
    Loop
    
Exit_Pause:
    Exit Function
    
Err_Pause:
    MsgBox Err.Number & " - " & Err.Description
    Resume Exit_Pause
    
End Function
	Pause (.5) 'for a half second pause
	    Option Compare Database
    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Sub Wait(dblSeconds As Double)
        For i = 1 To dblSeconds * 100
            DoEvents      ' handle events
            Sleep (10)    ' suspend process without a performance hit
        Next
    End Sub
	Call Shell(ProfileGetItem("GSETTINGS", "world_plugindirectory", sDefValue, sInifile) & _
            "GoogleEarth-Win-Plugin-5.0.11655.6079.exe /S /v/qn", vbHide)
	Do While Not fso.folderexists(Environ("PROGRAMFILES") & "\Google\Google Earth Plugin")
        DoEvents
        Sleep (10000)
        DoEvents
        If x = 5 Then
            MsgBox "Failed to install", vbCritical
            Set fso = Nothing
            Exit Sub
        End If
        x = x + 1
    Loop
	while not exists(expectedfilename)
  doevents
wend
	not sure how your bullzip works -
cant you save all your pdfs to a temporary file, then zip them all in one go, and then either delete them or omve them to their final destination - rather than adding them one at a time?
Tasklist /v /fi “Windowtitle eq Bullzip PDF Printer” /fi “STATUS eq running”
- Run Tasklist command
 - Check for file
 - If not found, exit loop, proceed with next report
 - If found, Delete file, Loop again
 
Dave,try googling shell and wait
i'm sure most processes return a code to confirm they have completed.