AllFolders Property

       

Returns a WebFolders collection that represents all folders in the current web.

expression.AllFolders

expression   Required. An expression that returns one of the objects in the Applies To list.

Remarks

The WebFolders collection returns all folders in the collection regardless of their position in the web hierarchy.

Example

The following example searches through the WebFolders collection for a folder named "Folder1". If the folder is found, the example searches for a file with the title Main Page. If the title is found, the file is opened in Microsoft FrontPage.

Sub WebFoldersFind()
'Returns a collection of all files in the current web.

    Dim objApp As FrontPage.Application
    Dim objWebFolder As WebFolder
    Dim objWebFolders As WebFolders
    Set objApp = FrontPage.Application
    'Create a reference to the WebFolders collection.
    Set objWebFolders = objApp.ActiveWeb.AllFolders

    'Check each folder in the collection for the name "Folder1"
    For Each objWebFolder In objWebFolders
       'If the name is found then
       If objWebFolder.Name = "Folder1" Then
          'If found then search through folder
          For i = 1 To objWebFolder.Files.Count
              'Search for a file with the title Main Page
              If objWebFolder.Files.Item(i).Title = "Main Page" Then
                  'Open file.
                  objWebFolder.Files.Item(i).Open
              End If
          Next i
       End If
    'If not found check next file.
    Next objWebFolder

End Sub