+ Reply to Thread
Results 1 to 6 of 6

List Most Recent File Creation Date

  1. #1
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    List Most Recent File Creation Date

    Hi all I put together some code which at the end of it I am wanting to show in cell D1 the creation date for the most recently created file found.

    Please Login or Register  to view this content.
    The code runs but, I'm not getting it to return the date value.
    Any help is appreciated.

    Thanks,

    BDB
    Last edited by bdb1974; 12-02-2009 at 07:03 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: List Most Recent File Creation Date

    Hi,

    What happens if you comment out the On Error Resume Next?
    Does the macro still run to the end or does it halt with a Debug?

    Rgds
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: List Most Recent File Creation Date

    Hello BDB,

    If Sfile does not include the directory path, the working directory will be used. If the file is not found an error will occur "File Not Found". You have On Error Resume Next statements in the code. This is probably preventing you from seeing the error that file wasn't found. Comment out the On Error statements so yo can see the error.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: List Most Recent File Creation Date

    I commented out everything in the code except for what should bring in the file date.

    I also found a typo in the sheet name which I corrected
    Please Login or Register  to view this content.
    it's "JobNum" in sheet name. Not "JobNob".

    When I run, I get will now get a type mismatch for:

    Please Login or Register  to view this content.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: List Most Recent File Creation Date

    Hello bdb1974,

    You row and column references are reversed.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: List Most Recent File Creation Date

    Once again... Thanks Leith.

    That fixed it.

    BDB

+ 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