LayersNum Method

Returns the number of the layers in the layer collection of the document.

Applies to: Document object

Syntax

[[Set] countRet =] object.LayersNum ()

The LayersNum method syntax has these parts:

Part Description
object Required. An expression, that returns an instance of the Document object.
countRet Optional. A Long type variable.

Remarks

Never returns 0, as there's always at least one layer in the document.

Example

This example contains a application-level script.. The program displays the number of layers in each open documents by using the LayersNum method.

' Loop through all documents open in the application
' and display the name and number of layers 
' for each document
For i=1 To thisApp.DocsNum()
    TRACE "Document : " & thisApp.Doc(i).Name
    TRACE "    Number of layers = " & thisApp.Doc(i).LayersNum()
Next i

 

See Also

AddLayer method, Layer method, LayerByID method, LayerByName method, RemoveLayer method, RemoveLayerByID method, Layer object