+ Reply to Thread
Results 1 to 3 of 3

Macro to open specified file path with variable date

  1. #1
    Registered User
    Join Date
    06-26-2013
    Location
    New York, USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Macro to open specified file path with variable date

    Hi all,

    I'm looking to write a macro for an excel sheet that will open up a data file from my HD. The end goal is to have a macro that will automatically open a report file from the previous business day, and then copy and paste it into my current worksheet. The file changes daily, as it is the "daily reports." However, the path an string always stay the same, and the numbers at the end that change simply represent the date in the format yyyymmdd...

    An example for the file is "O:\Globe\Reports\DTD_TMCA_20130701. So, I start with -

    Dim strPath As String
    Dim strFind As String

    strPath = "O:\Globe\Reports"
    strFind = DTD_TMCA

    Now I need it to automatically take the file from the LAST WORKDAY (so for July 1, it would be June 28), such as the Workday function in excel that would read =WORKDAY(TODAY(),-1).

    Thanks for your help!

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Macro to open specified file path with variable date

    Have you tried changing strFind to:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-26-2013
    Location
    New York, USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Macro to open specified file path with variable date

    That worked, I had the function written incorrectly..Thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1