Delete Method

Microsoft FrontPage Visual Basic

Deletes an individual navigation node from the list of available nodes in the NavigationNodes collection.

expression.Delete(Index)

expression    Required. An expression that returns a NavigationNodes object.

Index   Optional Variant. Refers to an item in the navigation structure. Can be any number corresponding to an item in the navigation structure, with the index starting at zero.

ShowDelete method as it applies to the Properties object.

Deletes a property from the list of available properties in the Properties collection.

expression.Delete(PropertyKey)

expression    Required. An expression that returns a Properties object.

PropertyKey   Required String. A string that represents the property name.

ShowDelete method as it applies to the WebEx object.

Deletes a Web site from the list of available Web sites in the Webs collection.

expression.Delete(WebDeleteFlags)

expression    Required. An expression that returns one of the above objects.

WebDeleteFlags   Optional FpWebDeleteFlags. Determines what is deleted from the current Web site. Default is fpDeleteEntireWeb.

FpWebDeleteFlags can be one of these FpWebDeleteFlags constants.
fpDeleteEntireWeb default
fpDeleteFrontPageInfoFromWeb

ShowDelete method as it applies to the WebFiles and WebFolders objects.

Deletes a task from the list of available tasks in the WebFiles collection, or a folder or folders from the list of available folders in the WebFolders collection.

expression.Delete(Index)

expression    Required. An expression that returns one of the above objects.

Index   Required Variant. Refers to an item in the WebFiles or WebFolders collection. Can be any number corresponding to an item in the collection, with the index starting at zero.

ShowDelete method as it applies to the Webs object.

Deletes a Web site from the list of available Web sites in the Webs collection.

expression.Delete(Index, WebDeleteFlags)

expression    Required. An expression that returns a Webs object.

Index   Required Variant. Refers to an item in the Webs collection. Can be any number corresponding to an item in the collection, with the index starting at zero.

WebDeleteFlags   Optional FpWebDeleteFlags. Determines what is deleted from the current Web site. Default is fpDeleteEntireWeb.

FpWebDeleteFlags can be one of these FpWebDeleteFlags constants.
fpDeleteEntireWeb default
fpDeleteFrontPageInfoFromWeb

ShowDelete method as it applies to all other objects in the Applies To list.

Deletes the specified object from a Web site.

expression.Delete

expression    Required. An expression that returns one of the above objects.

Example

ShowAs it applies to the NavigationNodes object.

This example deletes the fourth navigation node of the second file in the active Web site.

Note  You must apply the navigation structure to the Web site in order for the changes to be applied to the Web site.

Private Sub DeleteNavNode()
    Dim myWeb As WebEx
    Dim myChildNodes As NavigationNodes
    Dim intResponse As Integer

    Set myWeb = ActiveWeb
    Set myChildNodes = _
        myWeb.RootFolder.WebFiles(1).NavigationNode.Children

    intResponse = MsgBox("Are you sure you want to " & _
        "delete this navigation node?", vbYesNo)
        
    If intResponse = vbYes Then
        Call myChildNodes.Delete(3)
        myWeb.ApplyNavigationStructure
    End If
End Sub

ShowAs it applies to the Properties object.

This example deletes the SaleText property from the Sales.htm file.

Private Sub DeleteProperty()
    Dim myFile As WebFile
    Dim myProp As String
    Dim intResponse As Integer
    
    myProp = "SaleText"

    Set myFile = ActiveWeb.RootFolder.Files("Sales.htm")
    
    intResponse = MsgBox("Are you sure you want to delete the " & _
        myProp & " property?", vbYesNo)
    
    If intrespons = vbYes Then
        myFile.Properties.Delete myProp
    End If
End Sub

ShowAs it applies to the WebEx object.

This example deletes a temporary Web site called TempWeb.

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

Private Sub DeleteWeb()
    Dim myWeb As WebEx
    Dim myTempWeb As WebEx
    Dim myFolders As WebFolders
    Dim myFolder As WebFolder
    Dim myWebToDelete As String
    Dim intResponse As String

    Set myWeb = Webs.Open("C:\My Documents\My Webs")
    Set myFolders = myWeb.RootFolder.Folders
    myWebToDelete = "TempWeb"

    For Each myFolder In myFolders
        If myFolder.IsWeb = True Then
            If myFolder.Name = myWebToDelete Then
                
                intResponse = MsgBox("Are you sure you want to delete " & _
                    "the " & myFolder.Name & " sub Web site?", vbYesNo)
                    
                If intResponse = vbYes Then
                    Set myTempWeb = Webs.Open(myFolder.Name)
                    myTempWeb.Delete
                End If
            End If
        End If
    Next
    
    ActiveWebWindow.Close
End Sub

ShowAs it applies to the WebFiles collection.

This statement deletes a file in the active Web site.

Note  To run this example, you must have a file called "C:\My Documents\My Web Sites\TempFile.htm". Or, you may substitute an alternative file name.

Private Sub DeleteWebFile()
    Dim intResponse As Integer
    
    intResponse = MsgBox("Are you sure you want " & _
        "to delete this file?", vbYesNo)
    
    If intResponse = vbYes Then
        ActiveWeb.RootFolder.Files.Delete "TempFile"
    End If
End Sub