The Item method returns an individual item from a collection. This is the default method of Documents, Shapes, Layers, and Windows collections.
Syntax
object.Item( Index )
Parameter |
Type |
Description |
Index |
Variant |
required; see remarks |
Remarks
The Index parameter is defined as follows:
For the Documents collection, Index can be a 1-based integer or the complete path and file name of the document. The file name without the path can also be specified.
For the Shapes collection, Index can be a 1-based integer or the Object ID of the desired shape.
For the Windows collection, Index can be a 1-based integer or the name of the window as it appears in the window caption.
For the Layers collection, Index can be a 1-based integer or the name of the layer as it appears in the object manager.
Example
This example demonstrates how to return the names of the windows.
'Add two documents
mvApp.Documents.Add mvDocPlot ' Create a new, blank map document
mvApp.Documents.Add mvDocWks ' Create a new, blank worksheet document
'Declares Docs as an object
Dim Docs As Object
'Assigns the Windows collection to the variable named "Win"
Set Win = mvApp.Windows
Debug.Print Win.Item(Index:=1)
Debug.Print Win.Item(Index:=2)
Used by: Documents collection, Layers collection, Shapes collection, Windows collection