+ Reply to Thread
Results 1 to 8 of 8

Link or Open file by date modified

Hybrid View

  1. #1
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Link or Open file by date modified

    If there is only ONE of these dated files each day, then this would find and open that one file:
    Option Explicit
    
    Sub OpenDatedCSV2()
    Dim wbName As String, fPath As String
    
    fPath = "C:\2009\"      'remember the last \ in this string
    wbName = Dir("DailyReportSales." & Format(Date, "YYYYMMDD") & "*.csv")
    
    If wbName <> "" Then Workbooks.Open fPath & wbName
    
    End Sub
    Does this get you started?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  2. #2
    Registered User
    Join Date
    02-20-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    92

    Re: Link or Open file by date modified

    JBeaucaire,

    What if the they need the most recent file, which may not be current date.

    I am referring to this line from your latest post:
    wbName = Dir("DailyReportSales." & Format(Date, "YYYYMMDD") & "*.csv")
    For instance, what if they need to run this early in the morning and the latest file is prior day? Or 3 days prior after a weekend, etc.

    Thats the particular problem I am having. I'll begin a new thread to discuss because it might be different from this topic.
    Last edited by starcraftbud; 04-20-2010 at 11:32 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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