Represents a folder in a Microsoft FrontPage-based web. The WebFolder object is a member of the WebFolders collection.
Note The Folder object is a pointer to the WebFolder object.
The WebFolders collection represents all of the folders in a specified web. Within the WebFolders collection, individual WebFolder objects are indexed beginning with zero. The WebFolder object is similar to a folder in a directory-based hierarchy, however, the relationship between WebFolder objects and Web objects is unique. FrontPage provides the ability to create multiple Web objects on a Web server. Any WebFolder can represent a Web site, but every WebFolder does not necessarily represent a Web site. The web folder hierarchy provides the link to folders and files on a Web server directory. The navigation structure provides the underlying structure for the Web objects within individual FrontPage-based webs.
Using the WebFolder Object
Use WebFolders(index), where index is the PropertyKey of a web folder item, to return a single WebFolder object. The following example returns the file name of the first web folder item in the WebFolders collection.
ActiveDocument.WebFolders(0).Name
Use the collection properties such as Files, Folders, or Properties to return the collection object for the specified item. The following statements return the first specified item in the collection for the active web.
myFileOne = ActiveWeb.RootFolder.Files(0)
myFolderOne = ActiveWeb.RootFolder.Folders(0)
myPropertyOne = ActiveWeb.Properties("vti_author")
Use the properties such as IsExecutable, IsReadable, IsRoot, and so on, to check for the specified state of the folder. If you have CGI scripts that you'd like to execute, you can add the scripts to a folder and set the IsExecutable property on that folder to True. When you have content in a folder that you'd like others to browse, you can set the IsReadable property to True. If you want to check whether the current folder is the root folder, you can use the IsRoot property.The following example checks if files in the current WebFolder object are executable, read-only, or located in a root folder.
Private Sub GetFolderInfo()
Dim myWeb As Web
Dim myFolder As WebFolder
Dim myIsExe As Boolean
Dim myIsReadable As Boolean
Dim myIsRoot As Boolean
Set myWeb = ActiveWeb
Set myFolder = myWeb.RootFolder.Folders(1)
With myFolder
myIsExe = .IsExecutable
myIsReadable = .IsReadable
myIsRoot = .IsRoot
End With
End Sub
The IsExecutable, IsReadable, and IsWriteable properties return information about the state of the folder. The following examples show how to set the IsExecutable and IsReadable properties and read the IsWriteable property.
Note You cannot set the IsWriteable property, however you can set the IsExecutable and IsReadable properties for a WebFolder object.
Sub FolderProperties ()
Dim myFolder As WebFolder
Set myFolder = ActiveWeb.RootFolder.Folders(0)
If myFolder.IsWritable Then
MsgBox "Folder, " & myFolder.Url & " is writable"
End If
If Not(myFolder.IsReadable) Then
MyFolder.IsReadable = True
End If
If myFolder.IsExecutable Then
MyFolder.IsExecutable = False
End If
End Sub
Folders (or WebFolders) in FrontPage serve two purposes. They can be folders that help manage the content of the web, or, they can be webs. A web can have multiple subwebs below it. The IsWeb property returns True if the folder in question is a web. The following example uses the IsWeb property to determine if a folder is a web and if so, opens the web.
Note To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars" (for a server running on Windows NT). In either case, you may substitute an alternative web URL.
Private Sub CheckFolder()
Dim myFolder As WebFolder
Set myFolder = ActiveWeb.RootFolder.Folders("Rogue Cellars")
If myFolder.IsWeb = True Then
Webs.Open myFolder.Url
End If
End Sub
Use the Url property to return the URL of the current WebFolder object. The following statement returns the absolute URL for the eighth folder in the active Web.
myUrl = ActiveWeb.RootFolder.Folders(7).Url
Use the Copy, Delete, and Move methods to maintain your web structure. The following statement copies a WebFolder object from one folder to another folder, updates the links during the copy process, and forces an overwrite if the file already exists.
myFolder.Copy("C:\My Webs\New Adventure Products", True, True)