Count Property [Visio 2003 SDK Documentation]

Returns the number of objects in a collection.

intRet = object**.Count**

intRet     Integer. The number of objects in the collection.

object     Required. An expression that returns an object from the Applies to list.

Version added

2.0

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Count property to iterate through a Documents collection. It displays the names of all the open Microsoft Office Visio documents in the Immediate window.

Public Sub Count_Example()
 
    Dim intCounter As Integer
    Dim vsoDocument As Visio.Document 

    For intCounter = 1 To Documents.Count 
        'Get the next open document.
        Set vsoDocument = Documents.Item(intCounter) 

        'Print its name in the Immediate window. 
        Debug.Print vsoDocument.Name 
    Next intCounter 

End Sub

Applies to | AccelItems collection | AccelTables collection | Addons collection | Colors collection | Connects collection | Documents collection | EventList collection | Fonts collection | Hyperlinks collection | Layers collection | Masters collection | MasterShortcuts collection | MenuItems collection | Menus collection | MenuSets collection | OLEObjects collection | Pages collection | Path object | Paths collection | Row object | Section object | Selection object | Shapes collection | Styles collection | ToolbarItems collection | Toolbars collection | ToolbarSets collection | Windows collection