返回 WebFolders 集合,该集合代表当前站点中的所有文件夹。
expression.AllFolders
expression 必选。返回“应用于”列表中的对象之一的表达式。
WebFolders 集合返回集合中的所有文件夹,而不管其在站点层次结构中的位置。
下列示例在 WebFolders 集合中搜索名为“Folder1”的文件夹。如果找到该文件夹,则该示例接着搜索标题为 Main Page 的文件。如果找到该标题,则在 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