Document.Pages Property

Visio Automation Reference

Returns the Pages collection for a document. Read-only.

Version Information
 Version Added:  Visio 2.0

Syntax

expression.Pages

expression   A variable that represents a Document object.

Return Value
Pages

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Pages property to print the names of a document's pages.

Visual Basic for Applications
  
Public Sub Pages_Example()
 
    Dim intCounter As Integer
    Dim vsoDocument As Visio.Document 
    Dim vsoPages As Visio.Pages 
'Get the Pages collection for the active document. 
Set vsoPages = ActiveDocument.Pages

Debug.Print "Page names for document: "; ActiveDocument.Name

'Iterate through the pages and print the page name 
'in the Immediate window. 
For intCounter = 1 To vsoPages.Count 
    Debug.Print " "; vsoPages.Item(intCounter).Name 
Next intCounter 

End Sub

See Also