Table of contents
TOC
Collapse the table of content
Expand the table of content

Page.AddGuide Method (Visio)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Adds a guide to a drawing page.

Syntax

expression . AddGuide( Type , xPos , yPos )

expression A variable that represents a Page object.

Parameters

NameRequired/OptionalData TypeDescription
TypeRequiredIntegerThe type of guide to add.
xPosRequiredDoubleThe x-coordinate of a point on the guide.
yPosRequiredDoubleThe y-coordinate of a point on the guide.

Return Value

Shape

Remarks

The following constants declared by the Visio type library are valid values for guide types.

ConstantValueDescription
visPoint1Guide point
visHorz2Horizontal guide
visVert3Vertical guide

Example

The following macro shows how to add a horizontal guide to a page.


Public Sub AddGuide_Example() 

 Dim vsoPages As Visio.Pages 
 Dim vsoPage As Visio.Page 
 Dim vsoShapes As Visio.Shapes 
 Dim vsoShape As Visio.Shape 
 Dim vsoPageHeightCell as Visio.Cell 
 Dim intPageHeightIU as Integer 

 'Get the Pages collection of the ThisDocument object. 
 Set vsoPages = ThisDocument.Pages 

 'Set the Page object to the first page of the Pages collection. 
 Set vsoPage = vsoPages(1) 

 'Get the Shapes collection of the vsoPage object. 
 Set vsoShapes = vsoPage.Shapes 

 'Get the page height in internal units. 
 Set vsoPageHeightCell = vsoPage.PageSheet.CellsSRC( _ 
 visSectionObject, visRowPage, visPageHeight) 
 intPageHeightIU = vsoPageHeightCell.ResultIU 

 'Add a guide to the Shapes collection and set it 
 'as the vsoShape object. The guide is a horizontal line 
 'running through the middle of the page. 
 Set vsoShape = vsoPage.AddGuide(visHorz,0,intPageHeightIU/2) 

End Sub
© 2017 Microsoft