Select dated workbook

Hi, i am looking to select a workbook that will be dated differently

I want the code to look for

"MI Ledger Report"

So it doesnt need to find a specific date, just the workbook that  begins with "MI Ledger Report"

Thanks
Seamus

Seamus2626Asked:
Who is Participating?
 
ragnarok89Connect With a Mentor Commented:
try this:

Sub DoesWorkBookExist()
    
Dim i As Integer
With Application.FileSearch
    .LookIn = "C:\MyDocuments"
    '* represents wildcard characters
    .Filename = "MI Ledger Report*.xls"
    If .Execute > 0 Then 'Workbook exists
    For i = 1 To .FoundFiles.Count
        Workbooks.Open (.FoundFiles(i))
    Next i
    End If
End With

End Sub

Open in new window

0
 
Seamus2626Author Commented:
Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.