If your application is very practical then this may work. This will not work
in a situation such as:
Entity A is created
Entity B is created
Entity C is created
Entity B is DELETED
...now A is the entity before C, the code below would point to entity B,
which does not exist.
Sub TryThis()
Dim sHandle As String
Dim oEnt As AcadEntity
Dim Pt As Variant
'Get the first entity
ThisDrawing.Utility.GetEntity oEnt, Pt, "Pick an object: "
'Save the handle
sHandle = oEnt.Handle
'Delete the entity
oEnt.Delete
'Subtract one from the handle
sHandle = Hex(CSng("&h" & sHandle) - 1)
'Now you'll get the entity that was created BEFORE the first entity you
picked
Set oEnt = Application.ActiveDocument.HandleToObject(sHandle)
'And finally delete that entity also
oEnt.Delete
End Sub
"John Hope-Ross"
wrote in message
news:D67F846DFB40142715C8DB8E7DC5FE0C@in.WebX.maYIadrTaRb...
> This may not be the best way to do this, but here is what I thought of
> first:
>
> Use a select method to get the name of the name of the Item to be deleted
> using:
>
> SSet.Item(SSIndex).Name
>
> Then iterate throught the modelspace collection:
>
> index=0
> Do
> index=index +1
> Loop Until ThisDrawing.ModelSpace.Item(index).name=SSet.Item(SSIndex).Name
> or index >=ThisDrawing.ModelSpace.count
>
> When this loop ends, then ThisDrawing.ModelSpace.Item(index-1) is your
> objective.
>
> I have not actually tested this, but it should work in theory.
>
> JHR
>
> "philwil" wrote in message
> news:22C7E5A6282DF4137F2699D82AE719A2@in.WebX.maYIadrTaRb...
> > In a drawing I wish to erase an object in selecting, but also to erase
the
> > object which had been introduced before this object.
> > I suppose that it is necessary to call upon handel.
> > You have a good idea or a code vba for to help me.
> >
> > Thank you Belgium greets you.
> >
> > Philippe
> >
> >
> >
>
>