Determining the ZOrderPosition. What shape is what?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I determine the ZOrderPosition? What shape is what in the index? Is
there somewhere in Powerpoint that specifies the number of the shape in the
index?

I am trying to create a mouse-over effect in VBA using this script I found at:

http://skp.mvps.org/ppt00049.htm

This example is exactly what I want to do....
 
Would I be able to reference the shapes by their actual name? If so how would
I go about doing this roll over effect to do the same effect as below?
 
When doing a lot of work with shapes, it is best to name them. Look at
Example 8.7 on my site for some procedures for naming shapes:

http://www.PowerfulPowerPoint.com/

Click on "Examples by Chapter" and "Chapter 8" to find it.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

=?Utf-8?B?SW50cmljYXRlRm9vbA==?=
 
The ZOrder of the shapes is cleverly hidden in the number of the shape.

..Shape(1) is the farthest back thru .Shape(.Count) which is the front-most.


--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
vestprog2@ Please read the PowerPoint FAQ pages.
yahoo. They answer most of our questions.
com www.pptfaq.com
..
 
OK. Instead of:

Select Case oShp.ZOrderPosition

use:
Select Case oShp.name

Then, instead of Case 1, Case 2, ..., use the names in quotes. For
example, if one of your shapes is named banana, then use:

Case "banana"

--David
--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/=?Utf-8?B?SW50cmljYXRlRm9vbA==?=
 
I still can not seem to get this working...

Here is what I have as of now: (2 questions below)

Sub DisplayMessage(oShp As Shape)
' ascertain the position of the mouse by checking the
' index value of shape over which the mouse rests.
With SlideShowWindows(19).View.Slide _
.Shapes("Rounded rectangle 3").TextFrame.TextRange
Select Case oShp.Name
' The purple rectangle on which the buttons rest
' we use the event here to clear the existing message while
' the mouse moves to the next shape
Case "Text 8"
.Text = ""
Case "Text 7"
.Text = "Rewind inserted Flash movies automatically during the
slideshow. "
Case "Text 5"
.Text = "Take the bite out of event handling in PowerPoint 2000."
Case "Text 4"
.Text = "Peruse thru all the menu icons available in Microsoft
Office "
Case "Text 3"
.Text = "Import tons of images into PowerPoint fast."
Case "Rounded Rectangle 3"
.Text = "Password protect your presentations being
tampered/edited."
End Select
DoEvents
End With
End Sub

1.) What are the object names? Are they the names of the objects of what you
see in custom animation, such as "rectangle 1", "text 1", etc? Or is there a
way to name an object?

2.) .Shapes("Rounded rectangle 3").TextFrame.TextRange <- Should this be
something instead of "Rounded rectangle 3"

I have 4 rectangles with text on the left, that when you mouse over them I
want them to display corresponding text in the middle of ("rounded rectangle
3").

Where am I going wrong?

Also thank you for your help...
 
Fortunately, all three questions are the same question. It would be way
too easy if the names of the objects matched what you see in custom
animation:-) Unfortunately they don't. You can use a little VBA code to
set the names of the objects or get what the names are. Go to my site:

http://www.PowerfulPowerPoint.com/

Click on Examples by Chapter, and click on Chapter 8. The code you need
is Example 8.7. Just copy and paste the text version of that code into
the VBA editor and you will be able to name your shapes.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

=?Utf-8?B?SW50cmljYXRlRm9vbA==?=
 
One last ?

I have used your script for naming the shapes (Thank you). Now I have each
case followed by the new names. (e.g. instead of ' case 1 ', i now have 'case
"box1" '). I realize the ' .Shapes("box5").TextFrame.TextRange ' is declaring
the box which will display the text for all the mouse-overs, but it still is
not diplaying anything? Any suggestions as to why it still does not work? I
am going nuts trying to figure this out...

Example: I hover over newly named box1 and nothing is displayed in box5? I
have my action settings set to run the macro on mouse over. What is it that I
am not getting?

David , I really appreciate your help.
 
I'll need to see the current version of your code because what you are
trying to do is correct, but you must have some small hard-to-find
annoying little coding error (e.g., did you remember to change the name
of box 5?).
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

=?Utf-8?B?SW50cmljYXRlRm9vbA==?=
 
yeah changed all my names...
This is my code....

Sub DisplayMessage(oShp As Shape)
' ascertain the position of the mouse by checking the
' index value of shape over which the mouse rests.
With SlideShowWindows(19).View.Slide _
.Shapes("box6").TextFrame.TextRange
Select Case oShp.Name
Case "box1"
.Text = "" '<- Underlying rectangle that clears contents of box6
Case "box2"
.Text = "Box 2 contents description"
Case "box3"
.Text = "Box 3 contents description"
Case "box4"
.Text = "Box 4 contents description"
Case "box5"
.Text = "Box 5 contents description"
Case "box6"
.Text = "Box that displays all text from mouse-overs"

End Select
DoEvents
End With
End Sub

Thanks again. I will get this right, i promise...
 
What's up with the 19 (as in SlideShowWindows(19))? I changed that to 1
(and absolutely nothing else) and was able to get it working. Besides the
19, your code is perfect. If changing 19 to 1 doesn't help, then
something is wrong with your presentation (how you named the objects or
if their on something other than the current slide or something else),
but I suspect that killing 19 will serve you well.
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

=?Utf-8?B?SW50cmljYXRlRm9vbA==?=
 
Seems as though i am always making things harder than they are... That
worked! Thought the SlideShowWindows number had to be the number of the slide
that it was on...

oops

Thanks, you have been of much help.
 
No, that is the number of the SlideShow (assuming you have more than one
open at once, which you don't). The code you are using is set for the
current slide. If you want to affect another slide, try:

ActivePresentation.Slides(19).Shapes("box6")

This will impact the shape named "box6" on slide 19. Of course, once you
are naming shapes, you might as well names slides and use something like:

ActivePresentation.Slides("SlideWithTheBox").Shapes("box6")

I'm glad you got it working.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

=?Utf-8?B?SW50cmljYXRlRm9vbA==?=
 
Back
Top