laurenbattaglia
Technical User
I need to be able to find and open multiple workbooks each month. The workbooks will always be in the same folder and the name will always start with "EXP". I can find the files with the code below, I can't figure out how to open each file when it is found.
Private Sub CmdFndFile_Click()
Set fs = Application.FileSearch
Dim f
f = "EXP*"
Dim i As Integer
With fs
.LookIn = "C:\Documents and Settings\lbat\My Documents\lauren"
.FileName = ((f))
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub
Thanks, Lauren
Private Sub CmdFndFile_Click()
Set fs = Application.FileSearch
Dim f
f = "EXP*"
Dim i As Integer
With fs
.LookIn = "C:\Documents and Settings\lbat\My Documents\lauren"
.FileName = ((f))
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub
Thanks, Lauren