+ Reply to Thread
Results 1 to 5 of 5

How to identify new file added in the folder

  1. #1
    Forum Contributor prabhuduraraj09's Avatar
    Join Date
    05-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    330

    Question How to identify new file added in the folder

    Hi all,

    I have specific folder which have already few files in it. Everyday around 10 files will be added in that folder.

    Problem, is every time i have to get into the folder and check if the file is added and which file is added this is my pain.

    i need to know from vba to check the folder, if already 5 file is there it has to check and let me know when 6th file is added. and again when i run it , if no more file is added it should say no file added.

    can anyone help me with this.

    i have a sample code, but that will tell me all the file which added for today. I need this to be edited to suit my need. To know only the last file added in the folder.

    HTML Code: 
    Thank you

    If I have helped you in someway, use the * icon below to give reputation feedback, it is appreciated.

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: How to identify new file added in the folder

    Try this in attached file
    Date of file ignored- the macro can be tailored if necessary if the date needs to be taken into account

    There are 3 sheets:
    - the first time you run the macro all the files in your folder will be listed in sheet "Added Files", there will be no files in sheet "Old Files"
    - add a new file to your folder
    - run the macco again
    - sheet "Old Files" now reflects prior situation, sheet "List of Files" = current list, "Added Files" = newly added file only

    What the macro does:
    - uses 3 sheets to make it easy to see what is going on
    - copies previous list of files to "Old List"
    - creates a list of files currently in folder in "List of Files" and in "Added Files"
    - compares "Added Files" to "Old List"
    - deletes in "Added Files" those file names which match
    - "Added Files" now contains newly added files only

    At top of module:
    Please Login or Register  to view this content.
    The code:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kev_; 07-25-2017 at 07:28 AM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  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,258

    Re: How to identify new file added in the folder

    Hello prabhuduraraj09,

    This might be a solution you can use. This macro is a UDF (User Defined Function). It will return the path of the most recent file in the directory. You can chose to filter by creation date, date last modified, or date last accessed along with the file extension like "*.xlsx" for all xlsx files in the folder.

    Copy all the code and paste it into a new VBA Module in your workbook.
    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!)

  4. #4
    Forum Contributor prabhuduraraj09's Avatar
    Join Date
    05-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    330

    Re: How to identify new file added in the folder

    Hi Kev and Leith Ross,

    Would really like to Thank for the Support and help that you guys have did. Gave me two ways of thoughts now....which will help me.

    Thank you so much.

  5. #5
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: How to identify new file added in the folder

    You are welcome
    Thanks for marking the thread as solved and for the reps

+ 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. Identify all embedded documents in a folder with excel spreadsheets
    By johngeorge in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2017, 09:05 AM
  2. Replies: 4
    Last Post: 12-03-2016, 06:33 AM
  3. Highlight/Identify Newly pasted/added rows
    By markusvirus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-24-2015, 02:07 PM
  4. Pull data from csv files added into a network folder
    By aaron_burr in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-23-2014, 11:42 AM
  5. Formatting to Identify Accounts NOT Added to a Table
    By bmsrmd in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-07-2014, 04:24 PM
  6. Automatic updating a sheet when a file is added to a folder
    By teacher5th in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-24-2007, 09:18 PM
  7. 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