Export (0) Print
Expand All
1 out of 2 rated this helpful - Rate this topic

Selection.Count Property (Visio)

Published: July 16, 2012

Returns the number of objects in a collection. Read-only.

Version Added: Visio 2.0

expression .Count

expression A variable that represents a Selection object.

Return Value

Long

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 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 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.