I have tried to do some research but with no luck. I am trying to
create a macro that will open the most recent file with particular
filename strings. Another team saves files to a shared directory with
the following filenames:
TEST_1.DDMMYYYYHHMM
TEST_2.DDMMYYYYHHMM
The issue is that there may be days that there are no files and there
may be days with multiple files. This is what I have thus far:
Dim testfile as string
Dim count as integer
testfile="TEST_1"
count=1
Application.FileSearch
.NewSearch
.LookIn = "B:\"
.SearchSubFolders = False
.FileName = testfile
.Execute
Do Until count .FoundFiles.Count
If Format(FileDateTime(.FoundFiles(testfile)), "MM/DD/YYYY") <
Format(date, "MM/DD/YYYY") Then
Set wb = Workbooks.Open(FileName:=.FoundFiles(testfile),
ReadOnly:=True)
End If
Count=count+1
loop
End With
I think I'm about to go crazy.... any help will be greatly
appreciated!!
--
kwiklearner
------------------------------------------------------------------------
kwiklearner's Profile:
http://www.excelforum.com/member.php...o&userid=31909
View this thread:
http://www.excelforum.com/showthread...hreadid=574388