OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   function delete after duplicate (http://forum.oberonplace.com/showthread.php?t=264)

dominiqueL 17-10-2003 12:57

function delete after duplicate
 
Hi,
I have an object named Rect1
"Set Rect1 = ActiveShape"
I select all objects of the page and I duplicate

For Counter = 1 To (NumberX - 2)
ActiveShape.Duplicate 0, (DimY * Counter)
Next Counter
When I duplicated X time and that I want to suppress the "Rect1" objects, he/it only suppresses the first.

"Rect1.Delete"

how to make to erase all Rect1 ?

Alex 17-10-2003 14:42

Re: function delete after duplicate
 
Dominique,

When you call Shape.Duplicate, it returns you the newly created shape. You can assign it to a variable or store in a shape range. For example:

Code:

Dim s As Shape
Dim sr As New ShapeRange

Set s = ActiveShape
For i = 1 to 10

    Set s = s.Duplicate(...)
    sr.Add s ' Add the new shape to ShapeRange
Next i
...
sr.Delete ' Delete all shapes stored in the shape range


dominiqueL 18-10-2003 00:35

Re: function delete after duplicate
 
Alex,
It is a little more complicated than your answer, certainly Interesting, that will serve to me subsequently.
I have a Rect1 object well but with other included objects.
I duplicate all objects, but at the end I want to suppress the Rect1 object and these duplications only. I cannot use:
Set s = ActiveShape since it regroups Rect1 and the other objects.
cordially
Dominique


All times are GMT -5. The time now is 18:34.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com