Consulting

Results 1 to 3 of 3

Thread: Copy and Paste Shape on same Position as Source

  1. #1

    Copy and Paste Shape on same Position as Source

    Hi Guys,

    I am trying to create a Macro, which copies and pastes a selected shape on the same position as the selected shape.
    The pasted shape is meant to be positioned exactly over the source shape.
    I am using PP2003

    I never used VBA before, therefore I am completely unable to do this

    Thank you!

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Just to check you are doing this in edit mode. The code would be quite different in show mode.

    Personally I wouldn't copy paste but duplicate. I have included code for both though

    Sub copy_paste()
    Dim osld As Slide
    Dim oshp As Shape
    Dim oshpR As ShapeRange
    ' in case no shape is selected
    On Error Resume Next
    Set oshp = ActiveWindow.Selection.ShapeRange(1)
    If Err Then Exit Sub
    oshp.Copy
    Set osld = ActiveWindow.Selection.SlideRange(1)
    Set oshpR = osld.Shapes.Paste
    With oshpR
    .Left = oshp.Left
    .Top = oshp.Top
    End With
    End Sub
    
    
    Sub cloneMe()
    Dim osld As Slide
    Dim oshp As Shape
    On Error Resume Next
    Set oshp = ActiveWindow.Selection.ShapeRange(1)
    If Err  Then Exit Sub
    With oshp.Duplicate
    .Left = oshp.Left
    .Top = oshp.Top
    End With
    End Sub
    How to use code
    Last edited by John Wilson; 11-18-2013 at 06:18 AM.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    Great, thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •