![]() |
#1
|
|||
|
|||
![]()
Hello I did my best to search the site as this seems simple.
I want to act on the Index ID of a specific shape. For instance the following. Code:
Dim s As Shape For Each s In ActivePage.Shapes MsgBox s.Item.Index.Value Next s ActivePage.Shapes(X).Delete Then I should be able to delete all Shape IDs which are >= 1 Or <= 11 Am I just not thinking? Thanks! |
#2
|
|||
|
|||
![]()
Hi,
It's been a while on this one but I think you might approach it like this. HTH, Craig... Create a new ShapeRange Code:
Dim lcDelShapeRange As New ShapeRange Code:
For Each mShape In ActivePage.Shapes If mShape.Item.Index.Value >=1 And mShape.Item.Index.Value <=11 lcDelShapeRange.Add ActivePage.Shapes(lcShapeName) End if Next mShape Code:
If lcDelShapeRange.Count Then lcDelShapeRange.Delete End If Last edited by Craig Tucker; 08-02-2008 at 16:48. |
#3
|
|||
|
|||
![]()
Ok I just realized something that these id numbers change instantly so I wont be able to delete directly but rather add them to a shape range and then delete the range.
|
#4
|
|||
|
|||
![]()
Sorry I wasn't clear...
mShape.Item.Index.Value doesn't work I need to figure out how to retrive the ID from the Shape reference when parsing the ActivePage.Shapes object. |
#5
|
|||
|
|||
![]()
Another question what is the difference between these statements?
ActivePage.Shapes.Item(1) ActivePage.Shapes(2) |
#6
|
||||
|
||||
![]()
Index is the default property of Shapes object. So writing Shapes(1) or Shapes.Item(1) is the same thing. VBA automatically calls Shapes.Item(1) when it sees Shapes(1)
If you want to delete the first 11 shapes of the collection you can do this: Code:
Sub Delete11Shapes() Dim ss As Shapes Dim nCount As Long Dim i As Long Dim sr As New ShapeRange Set ss = ActivePage.Shapes nCount = ss.Count If nCount > 11 Then nCount = 11 For i = 1 To nCount sr.Add ss(i) Next i sr.Delete End Sub |
#7
|
|||
|
|||
![]()
Cool that makes sense thanks very much.
But just so I understand can you get that number (Shape(ID)) and echo it with something like MsgBox? or is it strictly internal? |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Symbol shape is not found in a group | squonk | CorelDRAW/Corel DESIGNER VBA | 1 | 14-06-2007 07:32 |
CorelDRAW X3 VBA Code - Shape & Color LIster | JudyHNM | Code Critique | 2 | 05-04-2007 15:02 |
Any idea what's wrong with this shape? | jemmyell | CorelDRAW/Corel DESIGNER VBA | 4 | 08-05-2006 19:15 |
Automatically generate colour index numbers from 8-bit palet | Jast | New product ideas | 3 | 07-07-2005 14:02 |
Howto uniquely identify a shape in VBA code | jemmyell | CorelDRAW/Corel DESIGNER VBA | 9 | 11-02-2005 22:05 |