Results 1 to 2 of 2

Thread: VBA Add slide to the end of the presentation

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    VBA Add slide to the end of the presentation

    currently tis code does paste sth from excel into powerpoint. Unfortunately it creates a slides in the beginning of the presentation. How do I change the code, that it adds a slide and therefore copies the range from excel to a new slide which is placed after the current slide?

    Sub copyRangeToPresentation()
    ' Open New PowerPoint Instance
    Set pptApp = CreateObject("PowerPoint.Application")
     With pptApp
        ' Activate exsting presentation
        Set ppt = .ActivePresentation
        ' Add A Blank Slide
        Set newSlide = ppt.Slides.Add(1, 12) ' ppLayoutBlank = 12
        ' Copy Range from Active Sheet in Excel
        ActiveSheet.Range("A1:E10").Copy
        ' Paste to Powerpoint as an Image
        newSlide.Shapes.PasteSpecial DataType:=2  '2 = ppPasteEnhancedMetafile
        ' Switch to PowerPoint
        .Activate
    End With
    End Sub
    Last edited by Aussiebear; 04-16-2023 at 04:04 PM. Reason: reduced the whitespace

Posting Permissions

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