Aligning multiple charts/tables in PPT

Djani

Board Regular
Joined
Aug 26, 2015
Messages
61
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.

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
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,215,237
Messages
6,123,800
Members
449,127
Latest member
Cyko

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top