+ Reply to Thread
Results 1 to 3 of 3

VBA code excel list of folder name, the folder path of subfolder, the file name & revision

  1. #1
    Registered User
    Join Date
    12-23-2015
    Location
    Malaysia
    MS-Off Ver
    2013 Microsoft Office
    Posts
    2

    Lightbulb VBA code excel list of folder name, the folder path of subfolder, the file name & revision

    Dear all,

    I would like to create an excel sheet which shows folder name, the folder path of subfolder, the file name in the subfolder which consists of 8 combination of characters and numbers and the updated revision numbers.

    I've written some codes as below and it can only shows the folder name and one of the folder name isn't appeared in the excel list. It would be highly appreciated if you could help.

    Thanks.

    Sub FolderNameList()

    Dim iFolder As Long
    Dim oFS0 As Object
    Dim oFolder As Object
    Dim oFldr As Object

    Set oFS0 = CreateObject("Scripting.FileSystemobject")
    Set oFolder = oFS0.getfolder("C:\Users\pwloo\Desktop\goal")

    For Each oFldr In oFolder.Subfolders
    iFolder = iFolder + 1
    Cells(iFolder, "A").Value = oFldr.Name
    Next oFldr

    'Insert the headers for Columns'
    Range("A1").Value = "Folder Name"
    Range("B1").Value = "Directory of subfolder"
    Range("C1").Value = "file name"
    Range("D1").Value = "numbers of file"


    Set oFolder = Nothing
    Set oFS0 = Nothing

    End Sub

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: VBA code excel list of folder name, the folder path of subfolder, the file name & revi

    I can't follow what you are trying to do? What folder name does not appear?

    Also, edit your post and wrap your code in code tags.
    Cheers
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,443

    Re: VBA code excel list of folder name, the folder path of subfolder, the file name & revi

    Very heavy cross poster

    links are to be found at http://www.msofficeforums.com/excel-...-workbook.html

+ 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. Replies: 12
    Last Post: 03-09-2015, 05:52 PM
  2. Excel template to create Folder/Subfolder List for mp3 albums
    By stuartm456 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-27-2014, 10:27 AM
  3. Code to list the folder path and sub folder path of a specific file
    By kalai1587 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2013, 03:51 AM
  4. Macro to Create Folder\Sub Folder\SubFolder\
    By coolhit in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-30-2012, 12:43 PM
  5. consolidating excel files into one file not using hard code of folder path
    By rrakkki in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-21-2011, 09:05 AM
  6. List folder path according to folder index
    By naflas in forum Excel General
    Replies: 4
    Last Post: 07-15-2010, 07:33 PM
  7. Replies: 1
    Last Post: 05-24-2007, 07:28 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