PDA

View Full Version : Solved: Size picture for each slide



Shazam
10-15-2006, 10:13 AM
Hi everyone,



Can anyone modify this code below . It only runs for one slide I would like the code to run for each slide in the powerpoint . The number of slides varies time to time. I tried to run tis code below but it gives me a run-time error.



Sub Size_Picture()

Dim ppPres As PowerPoint.Presentation
Dim ppSlide As PowerPoint.Slide
Dim ppShape As PowerPoint.Shape

For Each ppSlide In ppPres.Slides
For Each ppShape In ppSlide.Shapes

ActiveWindow.Selection.SlideRange.Shapes("Picture 19").Select
ActiveWindow.Selection.ShapeRange.ScaleWidth 0.99, msoFalse, msoScaleFromTopLeft
ActiveWindow.Selection.ShapeRange.ScaleWidth 0.99, msoFalse, msoScaleFromBottomRight
ActiveWindow.Selection.Unselect

Next ppShape
Next ppSlide
End Sub

TrippyTom
10-15-2006, 11:22 PM
What do you want the code to do? I see a few things wrong with the code you posted. But we need details of your intended goal before we can help you.

Shazam
10-16-2006, 05:52 AM
Thank You for responding TrippyTom. I figuered it out.

Thanks!



Sub Size_Picture()

Dim shp As Shape
Dim sld As Slide

For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.Type = msoPicture Then
shp.ScaleWidth 0.99, msoFalse, msoScaleFromTopLeft
shp.ScaleWidth 0.99, msoFalse, msoScaleFromBottomRight
'shp.Width = 812
End If
Next
Next
End Sub

TrippyTom
10-16-2006, 11:38 AM
Great job :)

The PowerPoint vba model is the worst!
I hate hate hate hate hate it.

But good job at figuring it out. I believe I might use part of your code for other things too. Thanks ;)

Shazam
10-16-2006, 04:03 PM
Great job :)

The PowerPoint vba model is the worst!
I hate hate hate hate hate it.

But good job at figuring it out. I believe I might use part of your code for other things too. Thanks ;)

Thanks!

My opinion I think MS Publisher is the worst. There are not too many examples for PowerPoint VBA on the net. But try to find any examples on Publisher it?s virtually nothing on the net.