PDA

View Full Version : Position Object



marathi.bana
11-01-2008, 02:37 AM
Please help to create following macro.......

I need macro coding to copy position of the autoshape (object) and apply this position to other autoshape.

John Wilson
11-03-2008, 06:40 AM
Please help to create following macro.......

I need macro coding to copy position of the autoshape (object) and apply this position to other autoshape.

Not quite sure what you need, maybe this sort of thing ...
Sub copy_pos()
Dim osourceshp As Shape
Dim otargetshp As Shape
Set osourceshp = ActivePresentation.Slides(1).Shapes("Rectangle 3")
Set otargetshp = ActivePresentation.Slides(2).Shapes("Oval 2")
otargetshp.Left = osourceshp.Left
otargetshp.Top = osourceshp.Top
Set osourceshp = Nothing
Set otargetshp = Nothing
End Sub

marathi.bana
11-18-2008, 03:49 AM
[quote=marathi.bana]Please help to create following macro.......

I want macro that will record the position of the one object or autoshape

and another macro that will apply that recorded position on other object or autoshape

John Wilson
11-18-2008, 06:40 AM
[quote=marathi.bana]Please help to create following macro.......

I want macro that will record the position of the one object or autoshape

and another macro that will apply that recorded position on other object or autoshape
Thats what the code above does, maybe this is more what you imagined

Public sngleft As Single
Public sngtop As Single
Sub pickup()
If ActiveWindow.Selection.Type <> ppSelectionShapes Then Exit Sub
With ActiveWindow.Selection.ShapeRange(1)
sngleft = .Left
sngtop = .Top
End With
End Sub
Sub apply()
If ActiveWindow.Selection.Type <> ppSelectionShapes Then Exit Sub
With ActiveWindow.Selection.ShapeRange(1)
.Left = sngleft
.Top = sngtop
End With
End Sub

Select a shape > run pickup and then select another shape and run apply