Consulting

Results 1 to 6 of 6

Thread: Macro for copying currently viewed slide in powerpoint show into new presentation

  1. #1

    Macro for copying currently viewed slide in powerpoint show into new presentation

    Hello all,

    I have a rather specific task in mind but am a real rookie at this.

    What I have: The user views the presentation as a show and navigates to various slides by clicking links in the earlier slides (this is all simple stuff that works fine). I have created a template slide that will be populated numerous different times: so it looks the same but the copy within is different, depending on the route the user took on the earlier slides.

    What I would like to do: Have a shape (with simple copy) within the slide that, once you've clicked it, copies the current slide into a new presentation with the same formatting. I am hoping only one macro will need to be written for this and I can apply it to all of the other slides (?)

    I've hunted high and low for a solution but I'm not winning with this one. Your help would be greatly appreciated!

    Best,
    James

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Something like this maybe

    Sub copyMe()
    Dim osld As Slide
    Dim newPres As Presentation
    Set osld = SlideShowWindows(1).View.Slide
    osld.Copy
    Set newPres = Presentations.Add
    newPres.Windows(1).Panes(1).Activate
    CommandBars.ExecuteMso ("PasteSourceFormatting")
    newPres.Windows(1).WindowState = ppWindowMinimized
    ' the new presentation will be minimised
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    Hi John,

    Thanks for your reply.

    When I run the code I get the error message:

    Run-time error '-2147188160 (80048240)':

    SlideShowWindows (unknown member) : Integer out of range. 1 is not in the valid range of 1 to 0.

    Apologies again if this is simple to fix!

    Best,
    James

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Are you running this in slide show mode? It is designed to be run when a shape is clicked in SHOW mode.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  5. #5
    John, you are a star. I was worried as the error was showing in the VBA window, but it works perfectly in the actual slideshow.

    Thank you so much.

  6. #6
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    You're welcome
    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
  •