Hello there
I'm trying to open all the files in a master folder while following the same order as in the workbook since each file depends on the ones before it
The problem is vba is using alphabetical order which makes some dependent files open before their source
Like i have a file "2." and "10." and "10." is dependent on "2." and it is opened and modified before "2."
I'm wondering if there is method so that i'll force vba to use the same order as in the folder.
i can't rename the files since it's company policy
I used the classic code :
Thanks in advance
I'm trying to open all the files in a master folder while following the same order as in the workbook since each file depends on the ones before it
The problem is vba is using alphabetical order which makes some dependent files open before their source
Like i have a file "2." and "10." and "10." is dependent on "2." and it is opened and modified before "2."
I'm wondering if there is method so that i'll force vba to use the same order as in the folder.
i can't rename the files since it's company policy
I used the classic code :
VBA Code:
Dim path2 As String
path2 = "C\user\masterwork\"
MyFiles = Dir(path2 & "\*.xl*")
Do While MyFiles <> ""
Set wkb = Workbooks.Open(path2 & MyFiles, UpdateLinks:=3)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlAutomatic
wkb.Close SaveChanges:=True
MyFiles = Dir
Loop
End sub