PDA

View Full Version : [SOLVED:] Macro for copying currently viewed slide in powerpoint show into new presentation



jdcauwood
04-03-2018, 01:19 AM
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

John Wilson
04-03-2018, 12:43 PM
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

jdcauwood
04-04-2018, 12:46 AM
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

John Wilson
04-04-2018, 12:56 AM
Are you running this in slide show mode? It is designed to be run when a shape is clicked in SHOW mode.

jdcauwood
04-04-2018, 01:27 AM
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.

John Wilson
04-04-2018, 03:42 AM
You're welcome