Wait until file exists

The solution for “Wait until file exists” can be found here. The following code will assist you in solving the problem.

Const timeoutSeconds As Long = 128

Public Function https://stackoverflow.com/questions/37065764/how-to-check-until-file-exist(ByVal theFileName As String) As Boolean
Dim startTime As Single
startTime = Timer

If FSO.FileExists(theFileName) Then
WaitForFileToExist = True
Exit Do
End If

Application.Wait Now + TimeValue(“0:00:01”)

timeElapsed = Timer – startTime
Loop Until timeElapsed > timeoutSeconds
End Function

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts