+ Reply to Thread
Results 1 to 6 of 6

Copy newest file in folder to a new folder with new name

  1. #1
    Registered User
    Join Date
    01-25-2013
    Location
    shelby,usa
    MS-Off Ver
    Excel 2010
    Posts
    32

    Copy newest file in folder to a new folder with new name

    I'm trying to look in a folder in which it will have many Excel files and find the newest .xlsx file in that folder and when it finds it I would like to copy that file to a new folder with a new name.

    1.Search "source" folder and find the newest Excel file in that source folder,
    2.Then copy it into a "destination" folder with a specific name (Weekly Report for Presentation)
    3.If Weekly Report for Presentation is already in the destination folder replace it with the newest copy.

    The source folder will have many Excel files all with basically the same name except with last part will have a date xx-xx-xx. It can search for the name or for the newest date a file was modified. Maybe it would be better to search for the newest date a file was modified.

    The folder path in the code will not be the path of the real files. I would want the macro in a separate Excel file that I can run from any folder/pc.

    Thanks for any help in advance!!


    Please Login or Register  to view this content.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: Copy newest file in folder to a new folder with new name

    Hi T_BOLT

    This link will assist in finding the latest file... Then just use 'file copy code where the code says 'open the latest file
    http://www.xl-central.com/open-the-l...-a-folder.html
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    01-25-2013
    Location
    shelby,usa
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Copy newest file in folder to a new folder with new name

    Sorry I have little knowledge of VB. I tried putting the two codes together by replacing the "open the latest file" with the code I had.
    I tried several different ways and I keep getting error at the bottom line.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: Copy newest file in folder to a new folder with new name

    Hi T_BOLT

    Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    This has been tested and works well

  5. #5
    Registered User
    Join Date
    01-25-2013
    Location
    shelby,usa
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Copy newest file in folder to a new folder with new name

    Thanks!! Works perfect!

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: Copy newest file in folder to a new folder with new name

    Glad I could help. thanks for the Rep points.

+ 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. open the newest excel file in a folder based on modified date
    By dulitul in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-17-2013, 12:52 PM
  2. Copy file from 1 folder to another folder
    By chidurala_shree in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-23-2013, 08:20 AM
  3. search for a file in a folder based on data, copy and paste it in another folder
    By kboy1289 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-05-2013, 11:47 AM
  4. [SOLVED] VBA Code open files in folder, copy text to workbook-Next time folder opened copy only new
    By Bikeman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-02-2013, 07:59 PM
  5. importing the newest file in a folder as text
    By hotwheels in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-06-2011, 08:58 PM
  6. Find newest file in a folder
    By duckboy1981 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-30-2008, 07:32 AM
  7. Moving all but the newest files from one folder to an Archive folder.
    By Zaphius in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-29-2007, 11:48 PM
  8. Replies: 6
    Last Post: 08-11-2006, 03:41 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