+ Reply to Thread
Results 1 to 3 of 3

List file names in folder

Hybrid View

Temporary-Failure List file names in folder 05-18-2013, 02:00 PM
shg Re: List file names in folder 05-18-2013, 02:39 PM
MaczaQ Re: List file names in folder 05-18-2013, 02:43 PM
  1. #1
    Registered User
    Join Date
    03-22-2010
    Location
    Finland
    MS-Off Ver
    Office 365
    Posts
    23

    List file names in folder

    I have folder that includes thousands pdf-files. They are numbered like
    14500.pdf
    .
    .
    15666 invoice.pdf
    .
    .
    23000 list.pdf

    and so on.

    I need macro which takes bigest number+1 of the file name and puts it in cell A1 (in this situation it should be 23001). I have macro which does this but problem is that it gets slower and slower every day because more files are coming every day. Is there any solution?

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: List file names in folder

    Please take a few minutes to read the forum rules about cross-posting.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: List file names in folder

    i don't know if it will be solution for you but try this:

    Function GreatFileNO(ByVal path As String) As String
        Set d = CreateObject("scripting.filesystemobject").getfolder(path).Files
        
         For Each f In d
            tmp = f.Name
         Next f
         
         GreatFileNO = tmp
        Set d = Nothing
    End Function
    Best Regards
    MaczaQ
    ---------------------------------------------------------------------------------------------------------------------------
    If you are satisfied with the solution(s) provided, please mark your thread as Solved
    If you are pleased with my answer consider to rate it. To thank someone who has helped you, click on the star icon below their name.
    - This way you will add him some reputation points ... thanks in advance.

+ 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