+ Reply to Thread
Results 1 to 8 of 8

List folders without using FSO

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Post List folders without using FSO

    I am trying to return an array of folder names without using FSO. Is there anyway Dir can be used to return folders only?

    Below is code I am trying to alter to return folder names

    Please Login or Register  to view this content.
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

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

    Re: List folders without using FSO

    You can And the attributes (via GetAttr) with vbDirectory to see if it's a file or folder.
    Last edited by shg; 08-01-2016 at 07:44 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: List folders without using FSO

    Quote Originally Posted by shg View Post
    You can And the attributes (via GetAttr) with vbDirectory to see if it's a file or folder.
    Thanks shg. When I use get attributes and vbDirectory, it returns a few files in addition to the folders.

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: List folders without using FSO

    Try this.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

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

    Re: List folders without using FSO

    @b2: Thank you.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: List folders without using FSO

    @shg: You're welcome and many thanks for rep points.

  7. #7
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: List folders without using FSO

    Thanks bakerman! (Reps) It works.


    For anyone who found on this thread while searching for a solution, the finished code is below:

    Please Login or Register  to view this content.
    Last edited by mc84excel; 08-09-2016 at 06:27 PM.

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: List folders without using FSO

    @ mc84excel

    You're welcome and 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. [SOLVED] Create folders and Sub folders and Sub-Sub folders from 5 columns with VBA
    By arleutwyler in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-11-2014, 04:16 PM
  2. [SOLVED] Need folders copies into other folders based on excel list
    By swmatrixman in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-19-2013, 02:08 PM
  3. Replies: 0
    Last Post: 12-04-2012, 01:01 PM
  4. List of Folders
    By toocold in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-01-2008, 10:28 PM
  5. Make folders from List
    By Vlad999 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2007, 01:41 AM
  6. [SOLVED] Creating List From Folders
    By Don in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-10-2006, 07:50 PM
  7. [SOLVED] List of Folders
    By marianne in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-07-2006, 06:55 AM
  8. List of folders in a certain directory
    By woolyhedgehog in forum Excel General
    Replies: 1
    Last Post: 10-19-2005, 12:05 PM

Tags for this Thread

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