Previous Document Next Document

Object Model Reference : Classes : L : Layer : Methods : Layer.FindShape


Layer.FindShape

Function FindShape([Name As String], [Type As cdrShapeType = cdrNoShape], [StaticID As Long], [Recursive As Boolean = True]) As Shape

Description

Member of Layer

The FindShape method locates a shape with specified properties on a layer. If the shape cannot be found, an empty reference (nothing) is returned.

Parameter
Description
Name
Specifies the name of the shape for which to search. This parameter is optional.
Type
Specifies the shape type, and returns cdrShapeType. This parameter is optional, and its default value is cdrNoShape (0).
StaticID
Specifies the shape’s unique ID. This parameter is optional, and its default value is 0.
Recursive
Specifies whether to iterate through all shapes. This parameter is optional, and its default value is True.

VBA example

The following VBA example finds a rectangle named Frame and selects it.

Sub Test()
 Dim s As Shape
 Set s = ActiveLayer.FindShape(Name:="Frame", Type:=cdrRectangleShape)
 If s Is Nothing Then
  MsgBox "The rectangle 'Frame' cannot be found on layer " & ActiveLayer.Name
 Else
  s.CreateSelection
 End If
End Sub

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.