Previous Document Next Document
Layer.FindShape

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

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.

Parameters
Description
Name
Identifies the string value that uniquely identifies the shape on the layer
This parameter is optional.
Type
Identifies the type of shape. This value returns cdrShapeType.
This parameter is optional, and its default value is cdrNoShape (0).
StaticID
Specifies a value which represents a shape’s unique ID
This parameter is optional, and its default value is 0.
Recursive
Specifies whether to iterate through all of the shapes
This parameter is optional, and its default value is True.

The following code 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 2007 Corel Corporation. All rights reserved.