Dear all,
I am currently facing another challenge. I want to have a script that has the following logic:
- If there is one shape, keep it centered.
- If there are two shapes, move the first to the left and the second to the right by enough that they don't overlap. Resize them as well if they are large.
I have got a couple of snippets of a script, but it's not working for some reason. Can any of you help me? I already know the site of Jon Peltier that has a script to centralize the charts.
Yours sincerely,
Djani
I am currently facing another challenge. I want to have a script that has the following logic:
- If there is one shape, keep it centered.
- If there are two shapes, move the first to the left and the second to the right by enough that they don't overlap. Resize them as well if they are large.
I have got a couple of snippets of a script, but it's not working for some reason. Can any of you help me? I already know the site of Jon Peltier that has a script to centralize the charts.
Code:
Dim dSlideCenter As Double
With ppSld.Shapes(ppSld.Shapes.Count-1) ' first shape of two
dSlideCenter = .left + .width/2
.left = 1.5 * dSlideCenter - .width/2 ' center shape in left half of slide
End With
With ppSld.Shapes(ppSld.Shapes.Count) ' last shape of two
.left = 1.5 * dSlideCenter + .width/2 ' center shape in right half of slide
End With
' Align pasted chart
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
Yours sincerely,
Djani