Select dated workbook

Posted on 2011-10-26
Last Modified: 2012-05-12
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"


Question by:Seamus2626
    LVL 8

    Accepted Solution

    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


    Author Closing Comment

    Thank you!

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
    Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
    The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
    This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now