Title Property Example

At the same time as you're traversing the navigation nodes, you can also return the title (file name) of the file that's associated with a particular node. The following example returns the title of the file associated with a navigation node in the active FrontPage-based web.

Private Sub GetFileFromNavNode()
Dim myWeb As Web
Dim myNavNode As NavigationNode
Dim myFileFromNavNode As String

Set myWeb = ActiveWeb
Set myNavNode = _
    myWeb.RootNavigationNode.File.NavigationNode

With myNavNode
    myFileFromNavNode = .File.Title
End With
End Sub

The following example shows how you can set the title of the first file in the web.

Private Sub SetTitle()
Dim myWeb As Web
Dim myNewTitle As String
Dim myFile As WebFile

MyNewTitle = "Inventory.htm"
Set myWeb = ActiveWeb
Set myFile = myWeb.RootFolder.Files(0)

MyFile.Title = myNewTitle
End Sub