PDA

View Full Version : [SOLVED:] Autoshape Position exchange



magnel
08-07-2013, 04:37 AM
I am using Powerpoint 2010, and I am trying to exchange position of two autoshapes on the same slide. Can someone help me with the relevant code to exchange position of two autoshape.

John Wilson
08-07-2013, 10:52 AM
More info needed!

You need to at least say:

Edit mode or Show mode?
If Edit are the two shapes selected?
If show mode how will you identify the shapes (Name?)

magnel
08-07-2013, 06:23 PM
My apologies, want to switch position of the two autoshapes while in the edit mode when the two shapes are selected.

John Wilson
08-07-2013, 10:06 PM
Does this do it?
Sub swapem()
Dim oshp1 As Shape
Dim oshp2 As Shape
Dim sngL1 As Single
Dim sngT1 As Single
Set oshp1 = ActiveWindow.Selection.ShapeRange(1)
Set oshp2 = ActiveWindow.Selection.ShapeRange(2)
sngL1 = oshp1.Left
sngT1 = oshp1.Top
oshp1.Left = oshp2.Left
oshp1.Top = oshp2.Top
oshp2.Left = sngL1
oshp2.Top = sngT1
End Sub

magnel
08-08-2013, 01:24 AM
Awesome John, this works perfectly as required. Thank you so much.