Returns an instance of the Layer object that corresponds to the layer with the specified index in the layer collection of the document.
Applies to: Document object
[[Set] layerRet =] object.Layer ( index ) |
The Layer method syntax has these parts:
Part | Description |
object | Required. An expression, that returns an instance of the Document object. |
index | Required. An expression that returns a Long value. Indicates the index of the layer in the layer collection of the document. |
layerRet | Optional. A Layer type variable. |
If index is less than 1 or greater than the number of layers in the layer collection of the document, the Layer method returns Nothing. Use the LayersNum method to find out the number of layers in the layer collection of the document. .
This example contains a document-level script. The program uses the Layer method to go through all layers in the layer collection of the document, and displays properties of each layer.
' Declare variables Dim i As Integer Dim player As Layer ' Loops through all layers in the document ' and display each layer's properties For i=1 To thisDoc.LayersNum() Set player = thisDoc.Layer(i) TRACE "Layer_# " & i TRACE " ID = " & player.ID TRACE " Name = " & player.Name TRACE " Visible = " & player.Visible TRACE " Locked = " & player.Locked TRACE " Printable = " & player.Printable TRACE " Colored = " & player.Colored Next i |
See Also |
AddLayer method, LayerByID method, LayerByName method, LayersNum method, RemoveLayer method, RemoveLayerByID method, Layer object |