Consulting

Results 1 to 2 of 2

Thread: Pasting copied slide into active presentation at current point

  1. #1
    VBAX Contributor
    Joined
    Apr 2015
    Location
    Germany
    Posts
    167
    Location

    Pasting copied slide into active presentation at current point

    Hi all,

    yesterday I realized, whenever I copy slides from one presentation to the active via VBA, I fit them in at the end of the presentation. So I tried out to hit the current position and found the solution below. But - whatever I did wrong then - today I get an error message marking "paste" and saying "View (unknown member): Invalid request. Clipboard is empty or contains data which may not be pasted here." Although when I debug before testing the macro, all seems to be fine with the code.

    It might be something ridiculous - could somebody please remove the black badge from my eyes? Thank you!

    Sub PasteInCompleteSlides()
        Dim src As Presentation
        Dim trg As Slide
        Dim shp As Shape
        Dim target As Presentation
        
         'Open the source presentation
        Set target = Application.Presentations.Open("C:\Users\Chef\Desktop\MyFiles.pptx")
        Set src = Presentations("MyFiles.pptx")
        
         'Select and copy the slide
        src.Slides(4).Copy
         
         'Close the source presentation
        With Application.Presentations("MyFiles.pptx")
            .Close
        End With
        
        'Go back to active presentation and paste, then go to pasted slide
        With ActiveWindow.View
        .Paste
        .GotoSlide (ActiveWindow.View.Slide.SlideIndex + 1)
        End With
                
    End Sub

  2. #2
    VBAX Contributor
    Joined
    Apr 2015
    Location
    Germany
    Posts
    167
    Location
    It WAS something ridiculous! Sorry for posting before thinking.

Posting Permissions

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