Previous Document Next Document
Layers.Item

Property Item(IndexOrName As Variant) As Layer

Member of Layers

The Item property returns the layer associated with a given index number.

The Item property is the default property and its reference can be omitted when referencing items in the collection. For example, Layers.Item(2) is the same as Layers(2) — they both reference the second layer object in the Layers collection.

You can access layers either by their index or name.

The Item property returns a read-only value.

Parameters
Description
IndexOrName
Specifies the item by its name or index number:
Index — Acts as a preset placeholder for each object in a Layers collection, uniquely identifying each member of the collection
Name — Represents the unique string value that identifies each layer

The following code example creates a rectangle on the topmost layer of the first page of the active document, and it also creates a horizontal line on the Guides layer:

Sub Test() 
 Dim d As Document 
 Dim p As Page 
 Set d = ActiveDocument 
 Set p = d.Pages(1) 
 p.Layers(1).CreateRectangle 0, 0, 3, 3 
 d.Pages(0).Layers("Guides").CreateLineSegment 0, 4, 5, 4 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.