Is it possible to populate a ShapeRange by adding shapes one at a time?
-
Monday, April 30, 2012 10:04 PM
I would like to be able to modify multiple lines on a slide.
I can loop through the shapes on the slide and find the desired lines.
Is there a way to add them to a collection one at a time or do I have to collect an array of names and create the collection all at once from the array?
I am hoping to modify endpoints of the lines by looping through the collection.
Should I use a Shapes collection or a ShapeRange to collect the references to the lines?
All Replies
-
Thursday, May 03, 2012 2:30 AMModerator
Hi Willian,
Thanks for posting in the MSDN Forum.
In my opinion, that Shapes collection to collect references of the line.
Have a good day,
Tom
Tom Xu [MSFT]
MSDN Community Support | Feedback to us
-
Thursday, May 03, 2012 2:42 PM
Thanks.
I ended up with something like this.
The conditions are as follows:
- There are shapes (lines) in a slide with items in the tags collection named BVertex and EVertex.
- The values for these tags are names of other shapes (ovals) in the slide.
The desired outcome is:
- By clicking on an oval on a slide, create a collection of any and all lines that have the name of the Shape that was clicked as values for BVertex or EVertex.
Private LineNameArray() As String Private VectorsAffected As ShapeRange Sub IdentifyVertex(ByVal Shp As Shape) Dim TestShape As Shape Dim I As Integer I = 0 For Each TestShape In Shp.Parent.Shapes If TestShape.Tags("BVertex") <> "" Then If (TestShape.Tags("BVertex") = Shp.Name) Or (TestShape.Tags("EVertex") = Shp.Name) Then I = I + 1 ReDim Preserve LineNameArray(I) LineNameArray(I) = TestShape.Name End If End If Next TestShape Set VectorsAffected = Shp.Parent.Shapes.Range(LineNameArray) End SubThe Subroutine is assigned to the ActionSettings(ppMouseClick).Run property of each oval shape in the slide.
-
Monday, May 07, 2012 7:52 AMModerator
Hi William,
The ShapeRange comes form Shapes interface so I don't think you are able to access it avoid Shapes interface. Create a collection will not access it.
Have a good day,
Tom
Tom Xu [MSFT]
MSDN Community Support | Feedback to us
- Proposed As Answer by Tom_Xu_WXModerator Tuesday, May 08, 2012 9:21 AM

