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
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.


how to make to erase all Rect1 ?

Alex 17-10-2003 14:42

Re: function delete after duplicate

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:


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
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.

All times are GMT -5. The time now is 01:59.

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