i have a function that opens a file makes changes then saves it to another file
and after that another function that takes this newly created file as an input and parses it.
the problem is it takes time for first function to write out the file and by that time the second file raises an error that file doesnt exist...
so i put up a while loop like this
VB Code:
Do While Not FileExists(App.Path & "\a22.htm") DoEvents Sleep (500) Loop Public Function FileExists(Filename As String) As Boolean Set fso = New FileSystemObject If fso.FileExists(Filename) Then FileExists = True Else FileExists = False End If End Function
but still the error repeats .how do i make the second function wait for the file to be created




Reply With Quote