This documentation is archived and is not being maintained.

WebFolder Object

Office 2003
Multiple objects
Multiple objects

Represents a folder in a Microsoft FrontPage-based Web site. 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 site. 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 WebEx objects on a Web server. Any WebFolder can represent a Web site, but every WebFolder does not necessarily represent a Web site. The 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 Web sites.

Using the WebFolder object

Use WebFolders(index), where index is the property key of a folder, to return a single WebFolder object. The following example returns the file name of the first folder item in the WebFolders collection.


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 site.

    myFileOne = ActiveWeb.RootFolder.Files(0)
myFolderOne = ActiveWeb.RootFolder.Folders(0)
myPropertyOne = ActiveWeb.Properties("vti_author")

Use such properties 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 of 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 WebEx
    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 collection) in FrontPage serve two purposes. They can be folders that help manage the contents of a Web site or they can be entire Web sites. A Web site can have multiple sub Web sites below it. The IsWeb property returns True if the folder in question is a Web subsite. The following example uses the IsWeb property to determine if a folder is a Web subsite and, if so, opens the Web site.

Note  To run this example, you must have a Web site called "C:\My Documents\My Web Sites\Coho Winery", or you may substitute an alternative Web site URL.

    Private Sub CheckFolder()
    Dim myFolder As WebFolder

    Set myFolder = ActiveWeb.RootFolder.Folders("Coho Winery")
    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 site.

    myUrl = ActiveWeb.RootFolder.Folders(7).Url

Use the Copy, Delete, and Move methods to maintain your Web site 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 Web Sites\New Adventure Products", True, True)

Methods | Copy Method | Delete Method | MakeWeb Method | Move Method | RemoveWeb Method