The code below loops through the open excel files if the file name is what the naming convention is close to it will then run the code in the if statment so that the file can be saved later on
This code works in excel 2003 but not in excel 2010, looking at each part of the code the myWindow.Caption
only appears to get 1 file name instead of the 5 that there hould be. What am I missing for it to loop though all of the files on 2010?
FYI - There are multple instances of the For
loop but since it is all the same code I havent pasted it here. Let me know if you want it but it is near enough identical
Sub File_Saver()
Dim iFileCount As Integer
Dim myWindow As Window
Dim r As Integer
With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With
For Each myWindow In Application.Windows
If LCase(myWindow.Caption) Like LCase("CHL?ISS*") Then
iFileCount = 1
r = 21
myWindow.Activate
'Set Column
c = B
GoTo Continue
Exit For
End If
Next myWindow