+ Reply to Thread
Results 1 to 5 of 5

List File Names From Folder

Hybrid View

CobraLAD List File Names From Folder 04-30-2009, 12:27 AM
rylo Re: List File Names From... 04-30-2009, 01:10 AM
CobraLAD Re: List File Names From... 04-30-2009, 01:25 AM
CobraLAD Re: List File Names From... 04-30-2009, 01:52 AM
rylo Re: List File Names From... 04-30-2009, 03:51 AM
  1. #1
    Forum Contributor CobraLAD's Avatar
    Join Date
    07-23-2007
    Location
    Boksburg, South Africa
    MS-Off Ver
    Office 2024
    Posts
    347

    List File Names From Folder

    Hi

    Can somebody help with a short easy code to open a browser to select a folder and list the files in that folder in excel. I do not want to include sub directories.

    Thank you
    Last edited by CobraLAD; 04-30-2009 at 02:37 AM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: List File Names From Folder

    Hi

    Run this code, select the directory, then cancel and the list of files will be displayed in column A.

    Sub aaa()
      Application.GetOpenFilename
      filess = Dir("*.*")
      Do While Not filess = ""
        Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Value = filess
        filess = Dir()
      Loop
      
      
    End Sub
    HTH

    rylo

  3. #3
    Forum Contributor CobraLAD's Avatar
    Join Date
    07-23-2007
    Location
    Boksburg, South Africa
    MS-Off Ver
    Office 2024
    Posts
    347

    Re: List File Names From Folder

    thank you rylo

  4. #4
    Forum Contributor CobraLAD's Avatar
    Join Date
    07-23-2007
    Location
    Boksburg, South Africa
    MS-Off Ver
    Office 2024
    Posts
    347

    Re: List File Names From Folder

    rylo

    this works 100%, but how do I add the path with the file name for example
    C:\My Work\book1.xls

  5. #5
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: List File Names From Folder

    Hi

    try changing
    Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Value = filess
    to

    Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Value = curdir & "\" & filess
    rylo

+ 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