LocateFolder Method

Microsoft FrontPage Visual Basic

Returns the specified WebFolder object.

expression.LocateFolder(FolderUrl)

expression    An expression that returns a WebFolder object.

FolderUrl    Required String. The default value is the folder portion of the URL.

Example

This example locates a folder in the root directory of a Web site.

Note  You must have a Web site open for all of these examples.

Private Sub LocateAFolder()
    Dim myFolderFound As WebFolder

    Set myFolderFound = Webs(0).LocateFolder("images")
End Sub

In most cases, you would probably use the entire URL for the String argument of the LocateFolder method. For example, a folder may be several levels deep in the folder hierarchy, such as C:/My Documents/My Web Sites/Rogue Cellars/Inventory/First_Quarter— and you want to locate First_Quarter. Any time a folder exists in a level deeper than the root directory of the Web site, use the entire URL as shown in the following example.

Private Sub GetFolder()
    Dim myFolder As String
    Dim myFolderFound As WebFolder

    myFolder = _
        "C:/My Documents/My Web Sites/Rogue Cellars/Inventory/First_Quarter"

    Set myFolderFound = _
        Webs(0).LocateFolder(myFolder)
End Sub

However, there is a shortcut. For example, if you want to locate an images folder that resides in the root directory of the Web site, you can use a relative URL by using a forward slash followed by the subfolder name as shown in the following statement.

Set myFolderFound = Webs(0).LocateFolder("images/JPG")

Note  You cannot substitute a backslash in a relative URL.