Results 1 to 3 of 3
  1. #1
    JayRab is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Oct 2013
    Posts
    78

    Need help pulling the date from a file Name.

    Have these two file names:



    strfile = "(12-9-2013) Daily Equipment Usage.xlsx"

    strfile ="(12-10-2013) Daily Equipment Usage.xlsx" ' the ending of this can cange to - copy -copy(2).xlsx So length of strfile isnt constant or doesnt change by just 1
    also can have
    strfile="(1-1-2014) daily....."


    I am looking to just grab the Date from inside the parenthesis. I need this date to use in update query to date stamp all imports from this file.

    strNameUpdate = mid(strfile,2,10).

    this will give me 12-9-2013) for the first one , 12-10-2013 and 1-1-2014) for the third one.

    How do I get it to just return 12-9-2013 12-10-2013 1-1-2014

    Any tips or help would be awesome.

    have close to 300 files like this. so renaming not really an option

    thanks

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Code:
    Dim strFile As String
    strFile = "(12-10-2013) Daily Equ)ipment Usa(ge.xlsx"
    strFile = Left(strFile, InStr(strFile, ")") - 1)   'Trim off everything to the right of first Parenthesis + )
    strFile = Mid(strFile, InStr(strFile, "(") + 1)   'Trim off everything to the Left of first Parenthesis + (
    MsgBox strFile

  3. #3
    JayRab is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Oct 2013
    Posts
    78
    Awesome thanks.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Import Excel file based on a date and time in file name
    By nhylan in forum Import/Export Data
    Replies: 4
    Last Post: 04-16-2013, 03:26 PM
  2. Replies: 1
    Last Post: 06-07-2012, 02:06 PM
  3. Date and time formatting when pulling from a form field
    By avarusbrightfyre in forum Programming
    Replies: 3
    Last Post: 09-15-2011, 04:20 PM
  4. Date/time export to CSV file
    By kaptin in forum Import/Export Data
    Replies: 3
    Last Post: 05-08-2011, 06:57 AM
  5. Replies: 0
    Last Post: 07-27-2009, 07:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums