PDA

View Full Version : Pick shape and Copy shape to all the slides



balumail75
11-11-2011, 04:20 AM
Hello All,

I am trying to create a vba code to pick the shape and copy to all the slides in ppt 2007. Below is the code. It copies the shape in the same slide.

Thanks for your help.

Option Base 1
Dim selshp As Shape
Dim itop As Integer, ileft As Integer
Dim sld As Slide
Dim sldind As Integer
Public Sub pickshp()
sldind = ActiveWindow.View.Slide.SlideIndex
Set selshp = ActiveWindow.Selection.ShapeRange(1)
itop = selshp.Top
ileft = selshp.Left
End Sub
Public Sub copyshapetoallslides()
For Each sld In ActivePresentation.Slides
selshp(1).Duplicate
selshp.Top = itop
selshp.Left = ileft
Next sld
End Sub

Thanks and Regards,
Balu.

John Wilson
11-11-2011, 04:42 AM
Select the shape and run:
Sub Copy_Paste()
Dim oshp As Shape
Dim i As Integer
Dim osldcurrent As Slide
If ActiveWindow.Selection.Type = ppSelectionNone Then Exit Sub
If ActiveWindow.Selection.ShapeRange.Count <> 1 Then Exit Sub
Set osldcurrent = ActiveWindow.Selection.SlideRange(1)
ActiveWindow.Selection.ShapeRange(1).Copy
For i = 1 To ActivePresentation.Slides.Count
If i <> osldcurrent.SlideIndex Then ActivePresentation.Slides(i).Shapes.Paste
Next i
End Sub

balumail75
11-11-2011, 04:55 AM
Thanks John, It's working. I have one more query. Is it possible to pick the shape? and copy it in only the necessary slides?

Thanks again for this help.

Regards,
Balu.