I'm using PPT 2007. I need to verify that I am referencing shapes and slides
by their correct number in my vba code. For the slide number, I am looking at
the slide number listed in the status bar in normal view of the slideshow.
For the shapes, I am looking at the number listed in the custom animation
pane for that shape or action button. Is this correct? I think I might be
using the wrong numbers in code, because I'm getting a message that says:
"Shapes(unknown member): Integer out of range. 15 is not in the valid range
of 1 to 13."

RE: determining slide number and object/shape number by john

john
Mon May 05 12:46:00 CDT 2008

In 2007 you can easily rename shapes in the selection pane.

eg rename the shape to "myshape"
and use .Shapes("Myshape") instead of the shape number which may not exist
or can easily change.

-------------------------------------------
Amazing PPT Hints, Tips and Tutorials

http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk


"Candace" wrote:

> I'm using PPT 2007. I need to verify that I am referencing shapes and slides
> by their correct number in my vba code. For the slide number, I am looking at
> the slide number listed in the status bar in normal view of the slideshow.
> For the shapes, I am looking at the number listed in the custom animation
> pane for that shape or action button. Is this correct? I think I might be
> using the wrong numbers in code, because I'm getting a message that says:
> "Shapes(unknown member): Integer out of range. 15 is not in the valid range
> of 1 to 13."

RE: determining slide number and object/shape number by David

David
Mon May 05 13:25:40 CDT 2008

In the old versions, it was a pain to figure out the numbers, and it
required code to figure out or change the names (such as Example 8.7 on
my site). This is one nice new features in 2007.
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

=?Utf-8?B?Sm9obiBXaWxzb24=?= <john AT technologytrish.co DOT uk> wrote
in news:CB6DDC91-5037-45FB-B9A2-48985D1D7E55@microsoft.com:

> In 2007 you can easily rename shapes in the selection pane.
>
> eg rename the shape to "myshape"
> and use .Shapes("Myshape") instead of the shape number which may not
> exist or can easily change.
>
> -------------------------------------------
> Amazing PPT Hints, Tips and Tutorials
>
> http://www.PPTAlchemy.co.uk
> http://www.technologytrish.co.uk
> email john AT technologytrish.co.uk
>
>
> "Candace" wrote:
>
>> I'm using PPT 2007. I need to verify that I am referencing shapes and
>> slides by their correct number in my vba code. For the slide number,
>> I am looking at the slide number listed in the status bar in normal
>> view of the slideshow. For the shapes, I am looking at the number
>> listed in the custom animation pane for that shape or action button.
>> Is this correct? I think I might be using the wrong numbers in code,
>> because I'm getting a message that says: "Shapes(unknown member):
>> Integer out of range. 15 is not in the valid range of 1 to 13."
>


RE: determining slide number and object/shape number by john

john
Mon May 05 13:54:01 CDT 2008

An extra bit, as you've found already - In 2007 the numbers in the animation
pane are NOT necessarily the shape numbers.
--
-------------------------------------------
Amazing PPT Hints, Tips and Tutorials

http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk


"John Wilson" wrote:

> In 2007 you can easily rename shapes in the selection pane.
>
> eg rename the shape to "myshape"
> and use .Shapes("Myshape") instead of the shape number which may not exist
> or can easily change.
>
> -------------------------------------------
> Amazing PPT Hints, Tips and Tutorials
>
> http://www.PPTAlchemy.co.uk
> http://www.technologytrish.co.uk
> email john AT technologytrish.co.uk
>
>
> "Candace" wrote:
>
> > I'm using PPT 2007. I need to verify that I am referencing shapes and slides
> > by their correct number in my vba code. For the slide number, I am looking at
> > the slide number listed in the status bar in normal view of the slideshow.
> > For the shapes, I am looking at the number listed in the custom animation
> > pane for that shape or action button. Is this correct? I think I might be
> > using the wrong numbers in code, because I'm getting a message that says:
> > "Shapes(unknown member): Integer out of range. 15 is not in the valid range
> > of 1 to 13."

Re: determining slide number and object/shape number by Shyam

Shyam
Tue May 06 09:52:52 CDT 2008

Candace,
FYI: PPT 2007 Z-Orderposition property has a bug.

If a slide has 2 shapes, the 1st being - a group containing 2 autoshapes
then the z-order position of the 2nd shape on the slide in PPT 2003 is 2 but
in PPT 2007 it is 3. Now, it would be fine if PPT 2007 handled this change.
But it does not, so now if you attempt to get reference to the 2nd shape
using the z-order value returned it will throw an error.

Regards,
Shyam Pillai

Image Importer Wizard
http://skp.mvps.org/iiw.htm




"Candace" <Candace@discussions.microsoft.com> wrote in message
news:6FAF697F-8FC7-466F-9B7B-4A7B542384F3@microsoft.com...
> I'm using PPT 2007. I need to verify that I am referencing shapes and
> slides
> by their correct number in my vba code. For the slide number, I am looking
> at
> the slide number listed in the status bar in normal view of the slideshow.
> For the shapes, I am looking at the number listed in the custom animation
> pane for that shape or action button. Is this correct? I think I might be
> using the wrong numbers in code, because I'm getting a message that says:
> "Shapes(unknown member): Integer out of range. 15 is not in the valid
> range
> of 1 to 13."


Re: determining slide number and object/shape number by Steve

Steve
Tue May 06 12:02:35 CDT 2008

In article <ewXoej4rIHA.672@TK2MSFTNGP02.phx.gbl>, Shyam Pillai wrote:
> Candace,
> FYI: PPT 2007 Z-Orderposition property has a bug.
>
> If a slide has 2 shapes, the 1st being - a group containing 2 autoshapes
> then the z-order position of the 2nd shape on the slide in PPT 2003 is 2 but
> in PPT 2007 it is 3. Now, it would be fine if PPT 2007 handled this change.
> But it does not, so now if you attempt to get reference to the 2nd shape
> using the z-order value returned it will throw an error.

<SpockTalk>
Interesting.
But is it logical, Captain?
Have you reported this anomaly to StarFleet/Redmond?
</SpockTalk>

The Z-order then reflects the way tabbing through the shape collection works.

So the WAR would be using shape names, shape tags (and both of those seem to
have their own problems in 2007).

Or iterate through the shapes with something like this (but see notes after):

Sub ShowZOrder()

Dim oSh As Shape

For Each oSh In ActivePresentation.Slides(1).Shapes
If oSh.Type = msoGroup Then
Debug.Print "GROUP at ZOrder: " & oSh.ZOrderPosition
Call HandleGroups(oSh)
Else
Debug.Print oSh.ZOrderPosition
End If
Next

End Sub

Sub HandleGroups(oGrpShape As Shape)
Dim oSh As Shape
For Each oSh In oGrpShape.GroupItems
If oSh.Type = msoGroup Then
Debug.Print "GROUP at ZOrder: " & oSh.ZOrderPosition
Call HandleGroups(oSh)
Else
Debug.Print oSh.ZOrderPosition
End If
Next
End Sub

===========

But that triggers another bug (one that also reflects the way tabbing order
works).

If you group two shapes, draw another shape, then group the group plus the new
shape:

Group2:

Group1:
Shape1
Shape2
Shape3

then tabbing through the shapes selects the "outer" group (Group2) then each
shape within the group, but NOT Group1.




>
> Regards,
> Shyam Pillai
>
> Image Importer Wizard
> http://skp.mvps.org/iiw.htm
>
> "Candace" <Candace@discussions.microsoft.com> wrote in message
> news:6FAF697F-8FC7-466F-9B7B-4A7B542384F3@microsoft.com...
> > I'm using PPT 2007. I need to verify that I am referencing shapes and
> > slides
> > by their correct number in my vba code. For the slide number, I am looking
> > at
> > the slide number listed in the status bar in normal view of the slideshow.
> > For the shapes, I am looking at the number listed in the custom animation
> > pane for that shape or action button. Is this correct? I think I might be
> > using the wrong numbers in code, because I'm getting a message that says:
> > "Shapes(unknown member): Integer out of range. 15 is not in the valid
> > range
> > of 1 to 13."
>

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================