PowerPoint 2000: Building a ShapeRange from shapes in a GroupItems collection

D

david.f.jenkins

How can I do that? The GroupShapes object in PPT 2000 doesn't have the
Range method I'm using in PPT 2003.

Is there a clever way to do this? Any way at all?

Thanks...
 
D

david.f.jenkins

I'd better elaborate.

I have a sub coded thusly:

sub GetTextRanges(CurrShRange as shaperange, by ref tRanges as
collection)

Dim ar() As Integer
dim sh As Shape
Dim shRange As ShapeRange

For Each sh In CurrShRange

If sh.Type = msoGroup Then
ReDim ar(0 To sh.GroupItems.Count - 1)
For i = 1 To sh.GroupItems.Count
ar(i - 1) = i
Next i
Set shRange = GroupItems.shapes.range(ar)
GetTextRanges shRange, tRanges
Else
If sh.HasTextFrame Then
tRanges.Add sh.TextFrame.TextRange
End If
End If

Next sh

Exit Sub

End Sub


The purpose of this recursive sub is to drill down to all shapes in a
shaperange that contain a textframe, and to add the associated
textrange to a collection of textranges. This works fine in PPT 2003,
but in PPT 2000 however, it fails to compile, since the shapes
collection apparently has no range method in that version.

Is there a way I can code around this so that this sub will work in
both PPT versions?
 
S

Shyam Pillai

Range isn't supported in PPT 2000 hence you have to individually pass the
shapes which means that you will need to modify your declaration
accordingly.

Here is an example of recursive function used to replace text across the
oresentation which works in all versions, you take a look at it. Let me know
if you have any questions.

http://skp.mvps.org/ppt00025.htm#2
 
D

david.f.jenkins

Thanks so much.

I had already deduced that that was the case (about .Range not being
supported). I modified the code to pass a Collection of shapes, rather
than a ShapeRange, and it appears to work. I'm not sure the ability to
pass the entire Collection at once (in my application the Collection
will almost always have only one item) is worth the overhead of
creating the Collection before each call, however, so I may follow your
lead and just make a direct call for each shape.

Have a good Friday 13th!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top