+ Reply to Thread
Results 1 to 13 of 13

Creating List From Folders

  1. #1
    Don
    Guest

    Creating List From Folders

    Hi Gang,

    Not sure if this is the correct forum or not but here goes....I would like
    to create a list of sub-folder names in either xcel or Word. I don't need to
    have the contents of the folders shown, only the names of same. All these
    sub-folders are in a seperate main folder on my C: drive. There are over 500
    sub-folders involved.

    If I'm in the wrong place, please advise where I might post this....TIA

    Don



  2. #2
    Jim Cone
    Guest

    Re: Creating List From Folders

    Don,
    The free Excel add-in "List Files" will list files and folders or just folders.
    It can also include the sub-folders in the list.
    Download from ... http://www.realezsites.com/bus/primitivesoftware
    No registration required.
    --
    Jim Cone
    San Francisco, USA


    "Don" <[email protected]>
    wrote in message
    Hi Gang,
    Not sure if this is the correct forum or not but here goes....I would like
    to create a list of sub-folder names in either xcel or Word. I don't need to
    have the contents of the folders shown, only the names of same. All these
    sub-folders are in a seperate main folder on my C: drive. There are over 500
    sub-folders involved.
    If I'm in the wrong place, please advise where I might post this....TIA
    Don



  3. #3
    Tom Ogilvy
    Guest

    RE: Creating List From Folders

    Sub Finddir()
    Dim FSO As Object
    Dim fDir As Object
    Dim fSubDir As Object
    Dim i As Long
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set fDir = FSO.GetFolder("C:\MyMainSubFolder")
    For Each fSubDir In fDir.SubFolders
    i = i + 1
    Cells(i, "A").Value = fSubDir.Name
    Next fSubDir
    End Sub

    --
    Regards,
    Tom Ogilvy

    "Don" wrote:

    > Hi Gang,
    >
    > Not sure if this is the correct forum or not but here goes....I would like
    > to create a list of sub-folder names in either xcel or Word. I don't need to
    > have the contents of the folders shown, only the names of same. All these
    > sub-folders are in a seperate main folder on my C: drive. There are over 500
    > sub-folders involved.
    >
    > If I'm in the wrong place, please advise where I might post this....TIA
    >
    > Don
    >
    >


  4. #4
    Don
    Guest

    Re: Creating List From Folders

    wow....quick reply...thanks Jim, I'll be looking at that add-in shortly.

    Thanks again,

    Don

    "Jim Cone" wrote:

    > Don,
    > The free Excel add-in "List Files" will list files and folders or just folders.
    > It can also include the sub-folders in the list.
    > Download from ... http://www.realezsites.com/bus/primitivesoftware
    > No registration required.
    > --
    > Jim Cone
    > San Francisco, USA
    >
    >
    > "Don" <[email protected]>
    > wrote in message
    > Hi Gang,
    > Not sure if this is the correct forum or not but here goes....I would like
    > to create a list of sub-folder names in either xcel or Word. I don't need to
    > have the contents of the folders shown, only the names of same. All these
    > sub-folders are in a seperate main folder on my C: drive. There are over 500
    > sub-folders involved.
    > If I'm in the wrong place, please advise where I might post this....TIA
    > Don
    >
    >
    >


  5. #5
    Don
    Guest

    RE: Creating List From Folders

    double wow.....another quick reply....thanks very much Tom, I'll be trying it
    soon,

    Thanks again,

    Don

    "Tom Ogilvy" wrote:

    > Sub Finddir()
    > Dim FSO As Object
    > Dim fDir As Object
    > Dim fSubDir As Object
    > Dim i As Long
    > Set FSO = CreateObject("Scripting.FileSystemObject")
    > Set fDir = FSO.GetFolder("C:\MyMainSubFolder")
    > For Each fSubDir In fDir.SubFolders
    > i = i + 1
    > Cells(i, "A").Value = fSubDir.Name
    > Next fSubDir
    > End Sub
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Don" wrote:
    >
    > > Hi Gang,
    > >
    > > Not sure if this is the correct forum or not but here goes....I would like
    > > to create a list of sub-folder names in either xcel or Word. I don't need to
    > > have the contents of the folders shown, only the names of same. All these
    > > sub-folders are in a seperate main folder on my C: drive. There are over 500
    > > sub-folders involved.
    > >
    > > If I'm in the wrong place, please advise where I might post this....TIA
    > >
    > > Don
    > >
    > >


  6. #6
    Don
    Guest

    Re: Creating List From Folders

    Jim,

    Worked perfectly....exactly what I was looking for.....Thanks much,

    Don

    "Jim Cone" wrote:

    > Don,
    > The free Excel add-in "List Files" will list files and folders or just folders.
    > It can also include the sub-folders in the list.
    > Download from ... http://www.realezsites.com/bus/primitivesoftware
    > No registration required.
    > --
    > Jim Cone
    > San Francisco, USA
    >
    >
    > "Don" <[email protected]>
    > wrote in message
    > Hi Gang,
    > Not sure if this is the correct forum or not but here goes....I would like
    > to create a list of sub-folder names in either xcel or Word. I don't need to
    > have the contents of the folders shown, only the names of same. All these
    > sub-folders are in a seperate main folder on my C: drive. There are over 500
    > sub-folders involved.
    > If I'm in the wrong place, please advise where I might post this....TIA
    > Don
    >
    >
    >


  7. #7
    Don
    Guest

    RE: Creating List From Folders

    Tom,

    Must be something I'm not understanding here....and that's not
    unusual....here's what I tried but it didn't do a thing, didn't give me a
    list or even an error msg. Can you please tell me what I've done wrong here?

    As I indicated above in this thread, Jim's add-in worked fine and gave me
    what I wanted but I'd sure like to understand your code also. Any help would
    be greatly appreciated.

    Don

    "Tom Ogilvy" wrote:

    > Sub Finddir()
    > Dim FSO As Object
    > Dim fDir As Object
    > Dim fSubDir As Object
    > Dim i As Long
    > Set FSO = CreateObject("Scripting.FileSystemObject")
    > Set fDir = FSO.GetFolder("C:\MyMainSubFolder")
    > For Each fSubDir In fDir.SubFolders
    > i = i + 1
    > Cells(i, "A").Value = fSubDir.Name
    > Next fSubDir
    > End Sub
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Don" wrote:
    >
    > > Hi Gang,
    > >
    > > Not sure if this is the correct forum or not but here goes....I would like
    > > to create a list of sub-folder names in either xcel or Word. I don't need to
    > > have the contents of the folders shown, only the names of same. All these
    > > sub-folders are in a seperate main folder on my C: drive. There are over 500
    > > sub-folders involved.
    > >
    > > If I'm in the wrong place, please advise where I might post this....TIA
    > >
    > > Don
    > >
    > >


  8. #8
    Don
    Guest

    RE: Creating List From Folders

    ooops....forgot to post the code....here it is:

    Sub Finddir()

    Dim FSO As Object
    Dim fDir As Object
    Dim fSubDir As Object

    Dim i As Long

    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set fDir = FSO.GetFolder("C:\Documents and Settings\Brner\My Documents\My
    Music\CDG Zips")
    For Each fSubDir In fDir.SubFolders
    i = i + 1
    Cells(i, "A").Value = fSubDir.Name
    Next fSubDir

    End Sub

    "Don" wrote:

    > Tom,
    >
    > Must be something I'm not understanding here....and that's not
    > unusual....here's what I tried but it didn't do a thing, didn't give me a
    > list or even an error msg. Can you please tell me what I've done wrong here?
    >
    > As I indicated above in this thread, Jim's add-in worked fine and gave me
    > what I wanted but I'd sure like to understand your code also. Any help would
    > be greatly appreciated.
    >
    > Don
    >
    > "Tom Ogilvy" wrote:
    >
    > > Sub Finddir()
    > > Dim FSO As Object
    > > Dim fDir As Object
    > > Dim fSubDir As Object
    > > Dim i As Long
    > > Set FSO = CreateObject("Scripting.FileSystemObject")
    > > Set fDir = FSO.GetFolder("C:\MyMainSubFolder")
    > > For Each fSubDir In fDir.SubFolders
    > > i = i + 1
    > > Cells(i, "A").Value = fSubDir.Name
    > > Next fSubDir
    > > End Sub
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > > "Don" wrote:
    > >
    > > > Hi Gang,
    > > >
    > > > Not sure if this is the correct forum or not but here goes....I would like
    > > > to create a list of sub-folder names in either xcel or Word. I don't need to
    > > > have the contents of the folders shown, only the names of same. All these
    > > > sub-folders are in a seperate main folder on my C: drive. There are over 500
    > > > sub-folders involved.
    > > >
    > > > If I'm in the wrong place, please advise where I might post this....TIA
    > > >
    > > > Don
    > > >
    > > >


  9. #9
    Jim Cone
    Guest

    Re: Creating List From Folders

    You are welcome. The feedback is appreciated.
    Jim Cone
    San Francisco, USA
    http://www.officeletter.com/blink/specialsort.html



    "Don" <[email protected]>
    wrote in message
    Jim,
    Worked perfectly....exactly what I was looking for.....Thanks much,
    Don


    "Jim Cone" wrote:
    > Don,
    > The free Excel add-in "List Files" will list files and folders or just folders.
    > It can also include the sub-folders in the list.
    > Download from ... http://www.realezsites.com/bus/primitivesoftware
    > No registration required.
    > Jim Cone
    > San Francisco, USA


    >
    >
    > "Don" <[email protected]>
    > wrote in message
    > Hi Gang,
    > Not sure if this is the correct forum or not but here goes....I would like
    > to create a list of sub-folder names in either xcel or Word. I don't need to
    > have the contents of the folders shown, only the names of same. All these
    > sub-folders are in a seperate main folder on my C: drive. There are over 500
    > sub-folders involved.
    > If I'm in the wrong place, please advise where I might post this....TIA
    > Don



  10. #10
    Tom Ogilvy
    Guest

    RE: Creating List From Folders

    In contrast, the code ran fine for me. did you look at the activesheet to
    see the results?

    --
    Regards,
    Tom Ogilvy


    "Don" wrote:

    > ooops....forgot to post the code....here it is:
    >
    > Sub Finddir()
    >
    > Dim FSO As Object
    > Dim fDir As Object
    > Dim fSubDir As Object
    >
    > Dim i As Long
    >
    > Set FSO = CreateObject("Scripting.FileSystemObject")
    > Set fDir = FSO.GetFolder("C:\Documents and Settings\Brner\My Documents\My
    > Music\CDG Zips")
    > For Each fSubDir In fDir.SubFolders
    > i = i + 1
    > Cells(i, "A").Value = fSubDir.Name
    > Next fSubDir
    >
    > End Sub
    >
    > "Don" wrote:
    >
    > > Tom,
    > >
    > > Must be something I'm not understanding here....and that's not
    > > unusual....here's what I tried but it didn't do a thing, didn't give me a
    > > list or even an error msg. Can you please tell me what I've done wrong here?
    > >
    > > As I indicated above in this thread, Jim's add-in worked fine and gave me
    > > what I wanted but I'd sure like to understand your code also. Any help would
    > > be greatly appreciated.
    > >
    > > Don
    > >
    > > "Tom Ogilvy" wrote:
    > >
    > > > Sub Finddir()
    > > > Dim FSO As Object
    > > > Dim fDir As Object
    > > > Dim fSubDir As Object
    > > > Dim i As Long
    > > > Set FSO = CreateObject("Scripting.FileSystemObject")
    > > > Set fDir = FSO.GetFolder("C:\MyMainSubFolder")
    > > > For Each fSubDir In fDir.SubFolders
    > > > i = i + 1
    > > > Cells(i, "A").Value = fSubDir.Name
    > > > Next fSubDir
    > > > End Sub
    > > >
    > > > --
    > > > Regards,
    > > > Tom Ogilvy
    > > >
    > > > "Don" wrote:
    > > >
    > > > > Hi Gang,
    > > > >
    > > > > Not sure if this is the correct forum or not but here goes....I would like
    > > > > to create a list of sub-folder names in either xcel or Word. I don't need to
    > > > > have the contents of the folders shown, only the names of same. All these
    > > > > sub-folders are in a seperate main folder on my C: drive. There are over 500
    > > > > sub-folders involved.
    > > > >
    > > > > If I'm in the wrong place, please advise where I might post this....TIA
    > > > >
    > > > > Don
    > > > >
    > > > >


  11. #11
    Don
    Guest

    RE: Creating List From Folders

    Tom,

    Not sure what's going on here.....I opened a clean wb and inserted the code
    as I posted into a module with sheet1 being the active sheet. Now I'm
    getting an error.

    "Ambiguous name detected: fDir"

    The line "fDir = FSO............." highlighted in red.

    Don


    "Tom Ogilvy" wrote:

    > In contrast, the code ran fine for me. did you look at the activesheet to
    > see the results?
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "Don" wrote:
    >
    > > ooops....forgot to post the code....here it is:
    > >
    > > Sub Finddir()
    > >
    > > Dim FSO As Object
    > > Dim fDir As Object
    > > Dim fSubDir As Object
    > >
    > > Dim i As Long
    > >
    > > Set FSO = CreateObject("Scripting.FileSystemObject")
    > > Set fDir = FSO.GetFolder("C:\Documents and Settings\Brner\My Documents\My
    > > Music\CDG Zips")
    > > For Each fSubDir In fDir.SubFolders
    > > i = i + 1
    > > Cells(i, "A").Value = fSubDir.Name
    > > Next fSubDir
    > >
    > > End Sub
    > >
    > > "Don" wrote:
    > >
    > > > Tom,
    > > >
    > > > Must be something I'm not understanding here....and that's not
    > > > unusual....here's what I tried but it didn't do a thing, didn't give me a
    > > > list or even an error msg. Can you please tell me what I've done wrong here?
    > > >
    > > > As I indicated above in this thread, Jim's add-in worked fine and gave me
    > > > what I wanted but I'd sure like to understand your code also. Any help would
    > > > be greatly appreciated.
    > > >
    > > > Don
    > > >
    > > > "Tom Ogilvy" wrote:
    > > >
    > > > > Sub Finddir()
    > > > > Dim FSO As Object
    > > > > Dim fDir As Object
    > > > > Dim fSubDir As Object
    > > > > Dim i As Long
    > > > > Set FSO = CreateObject("Scripting.FileSystemObject")
    > > > > Set fDir = FSO.GetFolder("C:\MyMainSubFolder")
    > > > > For Each fSubDir In fDir.SubFolders
    > > > > i = i + 1
    > > > > Cells(i, "A").Value = fSubDir.Name
    > > > > Next fSubDir
    > > > > End Sub
    > > > >
    > > > > --
    > > > > Regards,
    > > > > Tom Ogilvy
    > > > >
    > > > > "Don" wrote:
    > > > >
    > > > > > Hi Gang,
    > > > > >
    > > > > > Not sure if this is the correct forum or not but here goes....I would like
    > > > > > to create a list of sub-folder names in either xcel or Word. I don't need to
    > > > > > have the contents of the folders shown, only the names of same. All these
    > > > > > sub-folders are in a seperate main folder on my C: drive. There are over 500
    > > > > > sub-folders involved.
    > > > > >
    > > > > > If I'm in the wrong place, please advise where I might post this....TIA
    > > > > >
    > > > > > Don
    > > > > >
    > > > > >


  12. #12
    Tom Ogilvy
    Guest

    RE: Creating List From Folders

    Just to restate. I copied the code from YOUR email. Cleaned up any wordwrap
    problems and Changed the argument to a valid directory for my computer and
    ran it. It worked fine for me.

    So I can't say what your problem might be.

    --
    Regards,
    Tom Ogilvy



    "Don" wrote:

    > Tom,
    >
    > Not sure what's going on here.....I opened a clean wb and inserted the code
    > as I posted into a module with sheet1 being the active sheet. Now I'm
    > getting an error.
    >
    > "Ambiguous name detected: fDir"
    >
    > The line "fDir = FSO............." highlighted in red.
    >
    > Don
    >
    >
    > "Tom Ogilvy" wrote:
    >
    > > In contrast, the code ran fine for me. did you look at the activesheet to
    > > see the results?
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > >
    > > "Don" wrote:
    > >
    > > > ooops....forgot to post the code....here it is:
    > > >
    > > > Sub Finddir()
    > > >
    > > > Dim FSO As Object
    > > > Dim fDir As Object
    > > > Dim fSubDir As Object
    > > >
    > > > Dim i As Long
    > > >
    > > > Set FSO = CreateObject("Scripting.FileSystemObject")
    > > > Set fDir = FSO.GetFolder("C:\Documents and Settings\Brner\My Documents\My
    > > > Music\CDG Zips")
    > > > For Each fSubDir In fDir.SubFolders
    > > > i = i + 1
    > > > Cells(i, "A").Value = fSubDir.Name
    > > > Next fSubDir
    > > >
    > > > End Sub
    > > >
    > > > "Don" wrote:
    > > >
    > > > > Tom,
    > > > >
    > > > > Must be something I'm not understanding here....and that's not
    > > > > unusual....here's what I tried but it didn't do a thing, didn't give me a
    > > > > list or even an error msg. Can you please tell me what I've done wrong here?
    > > > >
    > > > > As I indicated above in this thread, Jim's add-in worked fine and gave me
    > > > > what I wanted but I'd sure like to understand your code also. Any help would
    > > > > be greatly appreciated.
    > > > >
    > > > > Don
    > > > >
    > > > > "Tom Ogilvy" wrote:
    > > > >
    > > > > > Sub Finddir()
    > > > > > Dim FSO As Object
    > > > > > Dim fDir As Object
    > > > > > Dim fSubDir As Object
    > > > > > Dim i As Long
    > > > > > Set FSO = CreateObject("Scripting.FileSystemObject")
    > > > > > Set fDir = FSO.GetFolder("C:\MyMainSubFolder")
    > > > > > For Each fSubDir In fDir.SubFolders
    > > > > > i = i + 1
    > > > > > Cells(i, "A").Value = fSubDir.Name
    > > > > > Next fSubDir
    > > > > > End Sub
    > > > > >
    > > > > > --
    > > > > > Regards,
    > > > > > Tom Ogilvy
    > > > > >
    > > > > > "Don" wrote:
    > > > > >
    > > > > > > Hi Gang,
    > > > > > >
    > > > > > > Not sure if this is the correct forum or not but here goes....I would like
    > > > > > > to create a list of sub-folder names in either xcel or Word. I don't need to
    > > > > > > have the contents of the folders shown, only the names of same. All these
    > > > > > > sub-folders are in a seperate main folder on my C: drive. There are over 500
    > > > > > > sub-folders involved.
    > > > > > >
    > > > > > > If I'm in the wrong place, please advise where I might post this....TIA
    > > > > > >
    > > > > > > Don
    > > > > > >
    > > > > > >


  13. #13
    Don
    Guest

    RE: Creating List From Folders

    Tom,

    Ok, found the problem and aside from me being a dummy here (which I find
    very hard to correct), the code now works. The error was caused by a word
    wrap problem. But the dummy thing I was doing was trying to make a list of
    zip files in that folder. The folder I directed your code to contained only
    zipped files, another folder contains the unzipped files (each in it's unique
    folder) Once I directed the code to the unzipped folder, the code worked
    fine, and the list of sub-folders was generated on Sheet1, Col A, as you said
    it would be.

    Thanks for staying with me on this, I do appreciate your help here.

    Have a great weekend,

    Don


    "Tom Ogilvy" wrote:

    > Just to restate. I copied the code from YOUR email. Cleaned up any wordwrap
    > problems and Changed the argument to a valid directory for my computer and
    > ran it. It worked fine for me.
    >
    > So I can't say what your problem might be.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    >
    > "Don" wrote:
    >
    > > Tom,
    > >
    > > Not sure what's going on here.....I opened a clean wb and inserted the code
    > > as I posted into a module with sheet1 being the active sheet. Now I'm
    > > getting an error.
    > >
    > > "Ambiguous name detected: fDir"
    > >
    > > The line "fDir = FSO............." highlighted in red.
    > >
    > > Don
    > >
    > >
    > > "Tom Ogilvy" wrote:
    > >
    > > > In contrast, the code ran fine for me. did you look at the activesheet to
    > > > see the results?
    > > >
    > > > --
    > > > Regards,
    > > > Tom Ogilvy
    > > >
    > > >
    > > > "Don" wrote:
    > > >
    > > > > ooops....forgot to post the code....here it is:
    > > > >
    > > > > Sub Finddir()
    > > > >
    > > > > Dim FSO As Object
    > > > > Dim fDir As Object
    > > > > Dim fSubDir As Object
    > > > >
    > > > > Dim i As Long
    > > > >
    > > > > Set FSO = CreateObject("Scripting.FileSystemObject")
    > > > > Set fDir = FSO.GetFolder("C:\Documents and Settings\Brner\My Documents\My
    > > > > Music\CDG Zips")
    > > > > For Each fSubDir In fDir.SubFolders
    > > > > i = i + 1
    > > > > Cells(i, "A").Value = fSubDir.Name
    > > > > Next fSubDir
    > > > >
    > > > > End Sub
    > > > >
    > > > > "Don" wrote:
    > > > >
    > > > > > Tom,
    > > > > >
    > > > > > Must be something I'm not understanding here....and that's not
    > > > > > unusual....here's what I tried but it didn't do a thing, didn't give me a
    > > > > > list or even an error msg. Can you please tell me what I've done wrong here?
    > > > > >
    > > > > > As I indicated above in this thread, Jim's add-in worked fine and gave me
    > > > > > what I wanted but I'd sure like to understand your code also. Any help would
    > > > > > be greatly appreciated.
    > > > > >
    > > > > > Don
    > > > > >
    > > > > > "Tom Ogilvy" wrote:
    > > > > >
    > > > > > > Sub Finddir()
    > > > > > > Dim FSO As Object
    > > > > > > Dim fDir As Object
    > > > > > > Dim fSubDir As Object
    > > > > > > Dim i As Long
    > > > > > > Set FSO = CreateObject("Scripting.FileSystemObject")
    > > > > > > Set fDir = FSO.GetFolder("C:\MyMainSubFolder")
    > > > > > > For Each fSubDir In fDir.SubFolders
    > > > > > > i = i + 1
    > > > > > > Cells(i, "A").Value = fSubDir.Name
    > > > > > > Next fSubDir
    > > > > > > End Sub
    > > > > > >
    > > > > > > --
    > > > > > > Regards,
    > > > > > > Tom Ogilvy
    > > > > > >
    > > > > > > "Don" wrote:
    > > > > > >
    > > > > > > > Hi Gang,
    > > > > > > >
    > > > > > > > Not sure if this is the correct forum or not but here goes....I would like
    > > > > > > > to create a list of sub-folder names in either xcel or Word. I don't need to
    > > > > > > > have the contents of the folders shown, only the names of same. All these
    > > > > > > > sub-folders are in a seperate main folder on my C: drive. There are over 500
    > > > > > > > sub-folders involved.
    > > > > > > >
    > > > > > > > If I'm in the wrong place, please advise where I might post this....TIA
    > > > > > > >
    > > > > > > > Don
    > > > > > > >
    > > > > > > >


+ 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