Hi This is the macro that loops continuously. It does call another macro but I know that other macro works.
HTML Code:
Sub AS4_checkFiles()
If Not (ActiveWorkbook.ReadOnly) Then ActiveWorkbook.ChangeFileAccess Mode:=xlReadOnly
Application.ScreenUpdating = 0
Myfolder = "Output"
Myfile1 = "Model1.Completed"
FlagBothFilesExist = 0
Mypath = ActiveWorkbook.Path
AllExtractsCompleted = 0
Sheets("Inputs").Select
Dim rng As Range
Set rng = Range("R14", Range("R" & Rows.Count).End(xlUp))
counter = 1
Do Until AllExtractsCompleted > 0
Application.StatusBar = " WAITING " & counter
For Each c In rng
FlagBothFilesExist = 0
a1 = Range("D" & c.Row)
a2 = Range("L" & c.Row)
b1 = Left(a1, Len(a1) - 4)
b2 = Left(a2, Len(a2) - 4)
c1 = b1 & "\" & Myfolder & "\" & Myfile1
c2 = b2 & "\" & Myfolder & "\" & Myfile1
d1 = Len(Dir(c1))
d2 = Len(Dir(c2))
e1 = Range("R" & c.Row)
f1 = Mypath & "\" & Range("AS1_FldStoreLive") & "\" & e1
f2 = Len(Dir(f1))
If d1 > 0 And d2 > 0 And f2 = 0 Then
FlagBothFilesExist = 1
d1 = 0
d2 = 0
Application.StatusBar = f1
Call AS3_Refresh(c.Row)
Application.StatusBar = False
Else
FlagBothFilesExist = 0
End If
Next c
counter = counter + 1
Loop
Set rng = Nothing
Application.ScreenUpdating = 1
If ActiveWorkbook.ReadOnly Then ActiveWorkbook.Close savechanges:=False
End Sub