fred3
Member
I've been using this code to update a sequence of files that are listed in column C starting at cell C2. Suddenly, it runs only the first one and stops.
Here is the calling code:
The one change that I suspect may have something to do with this is in the called file:
where I changed
from:
to:
And, the "from" code used to work!
So I'm chasing dynamic behaviors.....!
Here is the calling code:
Code:
Sub Updater()
'
' Updater Macro
'
'
Range("C2").Select
Dim cell As Range
Dim sFile As String
Application.ScreenUpdating = False
On Error Resume Next
For Each cell In Range("C2", Cells(Rows.Count, "C").End(xlUp)).Cells
sFile = cell.Value
If Len(Trim(sFile)) Then
If Len(Dir(sFile)) Then
Application.ScreenUpdating = False
Workbooks.Open sFile
If Err.Number Then
MsgBox "Can't open " & sFile
Err.Clear
Else
ActiveWorkbook.Close SaveChanges:=True
End If
Else
MsgBox "File " & sFile & " does not exist"
End If
End If
Next cell
Application.ScreenUpdating = True
End Sub
The one change that I suspect may have something to do with this is in the called file:
Code:
TimeSet = ThisWorkbook.Worksheets("Model").Range("F1").Value
If Hour(Now) < TimeSet Then
ThisWorkbook.Save
ThisWorkbook.Saved = True
Application.DisplayAlerts = False
ActiveWorkbook.Close False
Exit Sub
End If
from:
Code:
Application.Quit
Code:
ActiveWorkbook.Close False
And, the "from" code used to work!
So I'm chasing dynamic behaviors.....!