NavigationNodes Collection Object

See Also         Properties         Methods        

Application object
Webs object
Web object
RootNavigationNode object
NavigationNodes collection (NavigationNode)

A collection of NavigationNode objects within the navigation structure of a Microsoft FrontPage-based web. Each NavigationNode object represents a pointer to a page on a web. 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 navigation structure of a web, see the Children property. The following example builds a list of the navigation labels that are associated with each NavigationNode object in the NavigationNodes collection. The procedure exits when it reaches the end of the navigation structure.

Private Sub GetNavigationNode()
Dim myWeb As Web
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
        myNavNodeLbl = 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 navigation node to the rightmost position in the current navigation structure.

Private Sub AddNewNavNode()
Dim myWeb As Web
Dim myNewNavNode As NavigationNode
Dim myNavChildren As NavigationNode

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 navigation structure, you must apply the changes using the ApplyNavigationStructure method before the navigation structure is updated in FrontPage.