Consulting

Results 1 to 4 of 4

Thread: Placing shapes on different slides

  1. #1
    VBAX Regular
    Joined
    May 2017
    Posts
    18
    Location

    Placing shapes on different slides

    Hello,

    I wanted to add a quick VBA automation as I have to move multiple shapes to dedicated slides. Unfortunately, I can't figure out how to do it (I'm not familiar with arrays). For example: I have fifty shapes on a slide. Each shape should be 'cut' and pasted on a newly added slide. One by one. Below I have attached a code snippet.

    code.jpg

    I think
    slide.Shapes.Paste
    should be change to something like
    Set oshp = slide.Shapes.Paste
    or
    ActivePresentation.Slides(oshp.Parent.SlideIndex + 1).Shapes.Paste
    What I end up with are multiple empty slides and shapes moved from slide 1 to the last one.

    I really appreciate any help.
    Thank you in advance.
    Last edited by YorickG; 06-10-2021 at 02:12 PM.

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Quote Originally Posted by YorickG View Post
    Hello,

    I wanted to add a quick VBA automation as I have to move multiple shapes to dedicated slides. Unfortunately, I can't figure out how to do it (I'm not familiar with arrays). For example: I have fifty shapes on a slide. Each shape should be 'cut' and pasted on a newly added slide. One by one. Below I have attached a code snippet.

    code.jpg

    I think
    slide.Shapes.Paste
    should be change to something like
    Set oshp = slide.Shapes.Paste
    or
    ActivePresentation.Slides(oshp.Parent.SlideIndex + 1).Shapes.Paste
    What I end up with are multiple empty slides and shapes moved from slide 1 to the last one.

    I really appreciate any help.
    Thank you in advance.
    You are a lot more likely to get an accurate answer if you include your slide with 50 shapes.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Regular
    Joined
    May 2017
    Posts
    18
    Location
    Thank you John. Unfortunately I can't.
    I managed to improve it. However now I get an Integer error. Before I use macro I have to have the specific number of slides.

    11.jpg




    Error: (For example 3 shapes. 3 slide created)

    22.jpg

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Quote Originally Posted by YorickG View Post
    Thank you John. Unfortunately I can't.
    I managed to improve it. However now I get an Integer error. Before I use macro I have to have the specific number of slides.

    11.jpg




    Error: (For example 3 shapes. 3 slide created)

    22.jpg
    Without seeing the slide we are likely to be going round in circles (and I wont be!)

    A generic way to paste each shape onto a new slide is below. You would want to make sure thet the slide with the shapes has a blank layout (no placeholders) and is selected

    Sub move_shapes()
    Dim osld As Slide
    Dim oNewsld As Slide
    Dim L As Long
    'select slide with shapes
    Set osld = ActiveWindow.Selection.SlideRange(1)
    osld.Shapes.Range.Select
    
    
    For L = 1 To ActiveWindow.Selection.ShapeRange.Count
    Set oNewsld = ActivePresentation.Slides.AddSlide(osld.SlideIndex + L, osld.CustomLayout)
    ActiveWindow.Selection.ShapeRange(L).Copy
    oNewsld.Shapes.Paste
    Next L
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Posting Permissions

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