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"


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

Seamus2626Author Commented:
Thank you!
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.