RemoveWeb Method

Microsoft FrontPage Visual Basic

Removes a Web site.

expression.RemoveWeb(UserName, Password)

expression    An expression that returns a WebFolder object.

UserName    Optional String. The logon name of the user.

Password    Optional String. The password of the user.

Note  Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

Remarks

The RemoveWeb method is the complement of the MakeWeb method. Just as the MakeWeb method creates the meta data for the Web site from a folder, the RemoveWeb method removes the meta data for the Web site from a folder, but the folder remains intact. This is different from the Delete method for the WebEx object, where the entire contents of the specified Web site are removed.

Example

The following example removes a Web site from a folder. The folder and its contents remain intact, but the folder is no longer a Web site.

Note   You must have the Web site that contains the folder open.

Private Sub WebRemove()
    Dim myFolders As WebFolders
    Dim myFolder As WebFolder

    Set myWebFolders = Webs(0).RootFolder.Folders

    For Each myFolder In myFolders
        If myFolder.Name = "TempWeb" Then
            myFolder.RemoveWeb
            Exit For
        End If
    Next
End Sub