+ Reply to Thread
Results 1 to 3 of 3

Finding the last saved file in the folder that repeats the day of its creation"YYYY-MM-DD"

  1. #1
    Registered User
    Join Date
    11-15-2018
    Location
    Singapore
    MS-Off Ver
    Office 2016
    Posts
    1

    Unhappy Finding the last saved file in the folder that repeats the day of its creation"YYYY-MM-DD"

    Hi Friends,

    Need your kind help. Quite often I save reports in a folder that corresponds with today's date. Every time when I need to save a new report my macro creates a folder "YYYY-MM-DD" in the corresponding Quarter and Year folders (let's say C:\YYYY\Q#\YYYY-MM-DD). Now I want to write another piece of code (in addition to existing macro) which will make some comparison of today's and last saved reports. The problem is that I don't save reports every day and sometimes there could be 2-3 days gap in between. Could you please advise the way how I can find and open the last saved report? For simplicity let's assume that the name of report is always the same. All I need is to find the last created folder and to open the last saved report.

    Tried to use DateAdd function with the negative second argument, but failed since have no idea how to loop it... Please help

    Thanks in advance!

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

    Re: Finding the last saved file in the folder that repeats the day of its creation"YYYY-MM

    Hello Axacal,

    Welcome to the Forum!

    This macro will let you select the quarterly folder. It then searches for the most recent folders using the creation date. Once found, the file lasted created is opened.

    Add a new VBA Module to your workbook. Copy and paste the code below into the module.

    Please Login or Register  to view this content.
    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!)

  3. #3
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,285

    Re: Finding the last saved file in the folder that repeats the day of its creation"YYYY-MM

    Perhab like this
    Please Login or Register  to view this content.
    Last edited by daboho; 11-15-2018 at 06:07 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. """default folder in get open file"""
    By daboho in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-31-2017, 09:40 AM
  2. [SOLVED] Script to save to folder in "v:\dept2", confirm file saved, then delete from "v:\dept1"
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-28-2014, 11:42 AM
  3. MSoffice Outlook 2003 message to be saved in C dir with the file name "From" "Sent" "Sub"
    By shailendra0509 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-09-2012, 01:32 AM
  4. Finding MAX per hour interval when Date is "DD/MM/YYYY HH:MM"
    By bernborough in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-09-2010, 03:55 AM
  5. Saving a file to a "YYYY" and "MMM" folder
    By hriggs in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-10-2008, 07:00 AM
  6. [SOLVED] Finding the earliest "Last Saved Date" of Excel workbooks
    By Barb Reinhardt in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-21-2006, 12:40 PM
  7. Replies: 3
    Last Post: 11-02-2005, 06:17 PM

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