WebNavigationBarSet object (Publisher)

Represents a web navigation bar set for the current document. The WebNavigationBarSet object is a member of the WebNavigationBarSets collection, which includes all the web navigation bar sets in the current document.

Remarks

To add the specified web navigation bar to every page of a document, use the Left, Top, and Width parameters of the AddToEveryPage method, where Left is the position of the left edge of the shape, Top is the position of the top edge of the shape, and Width is the width of the shape representing the web navigation bar set.

To remove the web navigation bar set and every instance of it from a document, use the DeleteSetAndInstances method.

The following concern horizontally oriented web navigation bars:

  • Use the IsHorizontal property to determine the orientation of the navigation bar set.
  • Use the ChangeOrientation method to set the orientation of the web navigation bar set.
  • If the orientation is set to horizontal, you can then set the HorizontalAlignment and HorizontalButtonCount properties.

Example

The following example adds the first web navigation bar set to every page that has the AddToEveryPage method set to True when adding the page, or the WebPageOptions.IncludePageOnNewWebNavigationBars property set to True.

Dim objWebNavBarSet as WebNavigationBarSet 
Set objWebNavBarSet = ActiveDocument.WebNavigationBarSets(1) 
objWebNavBarSet.AddToEveryPage Left:=50, Top:=10, Width:=500

The following example deletes all instances of each WebNavigationBarSet object in the WebNavigationBarSets collection.

Dim objWebNavBarSet As WebNavigationBarSet 
For Each objWebNavBarSet In ActiveDocument.WebNavigationBarSets 
 objWebNavBarSet.DeleteSetAndInstances 
Next objWebNavBarSet

The following example adds the first navigation bar in the WebNavigationBarSets collection of the active document to each page that has the AddToEveryPage method set to True, or the IncludePageOnNewWebNavigationBars property set to True, and then sets the button style to small. A test is performed to determine whether the navigation bar set is horizontal. If it is not, the ChangeOrientation method is called and the orientation is set to horizontal. After the navigation bar is oriented horizontally, the horizontal button count is set to 3 and the horizontal alignment of the buttons is set to left.

Dim objWebNav As WebNavigationBarSet 
Set objWebNav = ActiveDocument.WebNavigationBarSets(1) 
With objWebNav 
 .AddToEveryPage Left:=10, Top:=10 
 If .IsHorizontal = False Then 
 .ChangeOrientation pbNavBarOrientHorizontal 
 End If 
 .HorizontalButtonCount = 3 
 .HorizontalAlignment = pbnbAlignLeft 
End With

Methods

Properties

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.