ppt 07 VBA compatability with ppt 03

T

Tom Conrad

I have code that runs during an active presentation. I recently tested the
code using a friend's PPT 07. The code ran fine with one exception.

There is an embedded picture (enhanced meta format) that generated an error.
The vba code rotates the picture. The error was that the picture was not
found within the shapes collection. I found the shape listed among the other
shapes and groups. I could rename the picture but I got the same error.

I tried a quick cut and paste to see if a newly embedded picture would be
found, but no joy. The picture was created from a grouped autoshape. The
autoshape was copied and then pasted special in enhanced meta format.

Did I get the error because pictures in PPT 07 are in a different collection?
Or, did the error derive from a difference in enh meta format between the 2
ppt versions?
' The next several lines place and rotate the picture 931
' picture 931 is in enhanced meta file format.

ActivePresentation.SlideShowWindow.View.Slide.Shapes("picture 931").Rotation
= Hdg

ActivePresentation.SlideShowWindow.View.Slide.Shapes("picture 931").Left =
(XPosAbs_1 -ActivePresentation.SlideShowWindow.View.Slide.Shapes("picture
931").Width / 2)

ActivePresentation.SlideShowWindow.View.Slide.Shapes("picture 931").Top =
(YPosAbs_1 - ActivePresentation.SlideShowWindow.View.Slide.Shapes("picture
931").Height / 2)
 
T

Tom Conrad

--
Tom Conrad


Steve Rindsberg said:
Comments scattered below:


Check to see if there's another shape of the same name. That's the usual
reason for this sort of weirdness.



While the following is ok, you can simplify it, make it easier to read and
marginally faster to run:


Dim oSh as Shape
Set oSh = ActivePresentation.SlideShowWindow.View.Slide.Shapes("picture 931")
With oSh
.Rotation = Hdg
.Left = (XPosAbs_1 -.Width / 2)
.Top = (YPosAbs_1 - .Height / 2)
End With

Ain't that purtier? ;-)

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Living in the Help Center at PowerPoint Live
Sept 21-24, San Diego CA, USA
www.pptlive.com
 

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