NavigationNodes Collection

Microsoft FrontPage Visual Basic

NavigationNodes Collection

Multiple objects NavigationNodes
NavigationNode
Multiple objects

A collection of NavigationNode objects within the navigational structure of a Microsoft FrontPage-based Web site. Each NavigationNode object represents a pointer to a page on a Web site. The NavigationNode object is a member of the NavigationNodes collection.

Using the NavigationNodes object

Use the NavigationNode property to return the NavigationNode object for a WebFile object. For more information on returning the collection of child nodes within the navigational structure of a Web site, see the Children property. The following example builds a list of the labels that are associated with each NavigationNode object in the NavigationNodes collection. The procedure exits when it reaches the end of the navigational structure.

Private Sub GetNavigationNode()
    Dim myWeb As WebEx
    Dim myWebFiles As WebFiles
    Dim myWebFile As WebFile
    Dim myNavNodeLabel As String
    Dim myLabel As String

    On Error Resume Next

    Set myWeb = ActiveWeb
    Set myFiles = myWeb.RootFolder.Files

    With myFiles
        For Each myFile In myFiles
            myLabel = myFile.NavigationNode.Label
            If Err <> 0 Then Exit Sub
            myNavNodeLabel = myNavNodeLabel & myLabel & vbCRLF
        Next
    End With
End Sub
		

Use Children(index), where index is the index number of an item in the collection of child nodes, to return a single NavigationNode object. The following example returns the first NavigationNode object in the collection— which is the home page.

Set myNavNodeOne = ActiveWeb.RootNavigationNode.Children(0)
		

Use the Add method to add a NavigationNode object to the NavigationNodes collection. The following example adds a node to the rightmost position in the current navigational structure.

Private Sub AddNewNavNode()
    Dim myWeb As WebEx
    Dim myNewNavNode As NavigationNode
    Dim myNavChildren As NavigationNodes

    Set myWeb = ActiveWeb
    Set myNavChildren = _
        myWeb.rootfolder.Files(1).NavigationNode.Children
    myNewNavNode = _
        myNavChildren.Add("C:\My Webs\Sale.htm", "Sale", fpStructRightmostChild)
    myWeb.ApplyNavigationStructure
End Sub
		

Note  After you finish modifying your navigational structure, you must apply the changes using the ApplyNavigationStructure method before the navigational structure is updated in FrontPage.