+ Reply to Thread
Results 1 to 2 of 2

Search Folders Method

  1. #1
    Registered User
    Join Date
    07-28-2005
    Posts
    9

    Search Folders Method

    i am using the FileSearch.SearchFolders method, and I want to search folders, for other folders. What mso* object can I use? Do I need to add a new reference? Right now, the best that I can find is msoFileTypeAllFiles, but that returns too many objects. Many thanks in advance

    Justin

  2. #2
    Edward Ulle
    Guest

    Re: Search Folders Method


    I'm not exactly sure what you will do with the folders but try this.

    Option Explicit

    ' Add Reference Microsoft Scripting Runtime

    Public Sub FindFolders()

    Dim fsoFileSystemObject As FileSystemObject
    Dim parentFolder As Folder
    Dim collectionOfFolders As Folders
    Dim childFolder As Folder
    Dim strTemp As String

    Set fsoFileSystemObject = CreateObject("Scripting.FileSystemObject")

    Set parentFolder = fsoFileSystemObject.GetFolder("C:\")
    Set collectionOfFolders = parentFolder.SubFolders

    For Each childFolder In collectionOfFolders
    strTemp = strTemp + childFolder.Name + vbCrLf
    Next

    MsgBox strTemp

    End Sub

    Good luck.



    *** Sent via Developersdex http://www.developersdex.com ***

+ 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