RulerGuide Object (Publisher)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Represents a gridline used to align objects on a page. The RulerGuide object is a member of the RulerGuides collection.

Use the Add method of the RulerGuides collection to create a new ruler gridline. Use the Item property to reference a ruler guide. Use the Position property to change the position of a gridline, and use the Delete method to remove a gridline. This example creates a new ruler guide, moves it, and then deletes it.

Sub AddChangeDeleteGuide() 
 Dim rgLine As RulerGuide 
 With ActiveDocument.Pages(1).RulerGuides 
 .Add Position:=InchesToPoints(1), _ 
 MsgBox "The ruler guide position is at one inch." 
 .Item(1).Position = InchesToPoints(3) 
 MsgBox "The ruler guide is now at three inches." 
 MsgBox "The ruler guide has been deleted." 
 End With 
End Sub
© 2016 Microsoft