+ Reply to Thread
Results 1 to 7 of 7

Populate listbox with file names by date modified??

  1. #1
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Populate listbox with file names by date modified??

    Hello .... I am using a simple piece of code to load text file names to a listbox. The trouble I am having is when I have to close the Excel userform, the listbox then populates the text file names in alphabetical order when the userform is re-opened. I need the listbox to load the text file names by date/time modified oldest to newest. Anyone know how to do this? I cannot seem to find an example anywhere on doing this.

    Thanks in advance for any help.

  2. #2
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Populate listbox with file names by date modified??

    See the last reply in this thread: http://www.experts-exchange.com/Soft..._22513040.html
    If you integrate this code into your module and populate your list box by the Function GetFilesInDateOrder, it should list it in the appropriate order
    Regards,
    Rudi

  3. #3
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: Populate listbox with file names by date modified??

    Thanks, Rudi .... I can't see the code because I am not a paid member. Can you post the code?

  4. #4
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Populate listbox with file names by date modified??

    Hi,

    I'm so sorry... I did not notice this was from a site that requires subscription.
    I don't want to violate any rules so I think it's best not to post code that requires unlocking from this site. However here is code from another site that could help resolve your issue with a bit of tweaking. See this page: http://vba2008.wordpress.com/2008/10...a-file-search/

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,641

    Re: Populate listbox with file names by date modified??

    Not tested.
    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Populate listbox with file names by date modified??

    Hi

    Not sure if the code above that I posted worked for you...?

    Here is a better code block that I tested. It creates an array variable that stores the file list and modified date. You can use the variable to populate your text box with the files in descending order by date.

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: Populate listbox with file names by date modified??

    Thanks RudiS and Jindon... I am playing around with both pieces of code and will report back. I am having a little trouble because I have a "Do Loop" and a "For Loop" in my code. I will post back tomorrow with my issues when I get on my other PC. Thanks again for all of your help.

+ 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. Finding File Creation date, saved date and last modified date
    By david systems in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-22-2013, 05:49 PM
  2. Retrieve File names from a folder with last modified username
    By elavarasans in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-10-2013, 12:48 PM
  3. Replies: 3
    Last Post: 08-21-2011, 07:55 PM
  4. Replies: 0
    Last Post: 08-21-2011, 07:38 AM
  5. populate all file names from folder to listbox
    By dan2010 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 08-21-2011, 06:34 AM

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