Results 1 to 2 of 2

Need VBA Macro to extract folder names and sub folder name

Threaded View

  1. #1
    Registered User
    Join Date
    12-31-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    19

    Need VBA Macro to extract folder names and sub folder name

    Hi All,
    Please help me by building a VBA code which extracts all folder names and sub folder names in a given path.
    Names of the folders and subfolders has to be extracted in a single.

    Below is the macro which I have a macro which will extract only Folder names of the Provided path, however i need Subfolder names as well.

    Sub FolderList()
    Dim iFolder As Long
    Dim Sno As Integer
    Dim oFSO As Object
    Dim oFolder As Object
    Dim oFldr As Object
    
    iFolder = 6
    Sno = 1
    Set oFSO = CreateObject("Scripting.FileSystemobject")
    Set oFolder = oFSO.getfolder(Range("I10"))         'here, Range("I10") is the cell where i give path
    For Each oFldr In oFolder.subfolders
    iFolder = iFolder + 1
    Cells(iFolder, "C").Value = Sno
    Cells(iFolder, "D").Value = oFldr.Name
    End Sub
    Please help.
    Last edited by Nanimadhu; 03-29-2014 at 06:11 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Extract files from a folder using the names listed in a excel
    By firdausvariava in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-21-2012, 08:34 AM
  2. Loop Through Folder - extract Wb and Sheet Names
    By max57 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-18-2010, 12:35 AM
  3. Extract file names from folder`
    By Dri in forum Excel General
    Replies: 3
    Last Post: 05-29-2007, 09:16 AM
  4. [SOLVED] Extract file names from folder
    By Haraki in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2006, 05:55 PM
  5. Extract folder names only
    By Michael Singmin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-12-2006, 08:55 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