Previous Document Next Document
Document.Selection

Function Selection() As Shape

Member of Document

The Selection property returns a special Selection shape that represents all selected shapes in the document.

You can use the Shapes collection of the Selection shape to access each individual selected shape. You can work with the Selection shape in almost the same way as you would with a regular shape. You can move, delete, and apply a fill/outline to it.

The following code example sets the selected objects to the lower left corner of the page and stretches them so they fit in a box that is 3" by 3".

Sub Test() 
 Dim s As Shape 
 Set s = ActiveDocument.Selection 
 If s.Shapes.Count = 0 Then 
  MsgBox "No Object Selected" 
  Exit Sub 
 End If 
 ActiveDocument.ReferencePoint = cdrBottomLeft 
 s.SetPosition 0, 0 
 s.SetSize 3, 3 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.