This documentation is archived and is not being maintained.

AllFolders Property

Office 2003

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

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 site 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()
    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 folder is found then search through each
       'file in the folder for a file with the title
       'Main Page and open the file if it exists.
       If objWebFolder.Name = "Folder1" Then
          For i = 1 To objWebFolder.Files.Count
              If objWebFolder.Files.Item(i).Title = "Main Page" Then
                  objWebFolder.Files.Item(i).Open
                  Exit For
              End If
          Next i
       End If

    'If not found check next file.
    Next objWebFolder

End Sub
  




Show: