PDA

View Full Version : Macro to reduce images size in a ppt, that worked in ppt 2007 but not in ppt 2013



Adam Brave
09-25-2015, 12:47 PM
Hi,

I've a macro that I used with some ppt's in office 2007 to reduce the size of some links within the ppt to an excel file. Recently I've installed the Office 2013 and the macro crashed with the following error:


Shape.select: invalid request. To select a shape, its view must be active

Here is the code:

Sub reduce()
For Each curr_slide In ActivePresentation.Slides
curr_slide.Select
For Each oSh In curr_slide.Shapes
If oSh.Type = msoLinkedOLEObject Then
Set oSh = curr_slide.Shapes(3)

With oSh
'.LinkFormat.BreakLink

.Select
.LockAspectRatio = False
.Height = 14 * 28.33
.Width = 33.5 * 28.33
.Cut
Set oSh = curr_slide.Shapes.PasteSpecial(DataType:=ppPastePNG)
.Height = 10 * 28.33
.Width = 23 * 28.33
.Left = 1.2 * 28.33
.Top = 1.85 * 28.33
.ZOrder (msoSendToBack)
End With
End If
Next oSh
Next curr_slide
End Sub


I believe now, I've to activate each shape in every slide but I dont know how to do it. Can someone help me?

Thanks in advance!