One of our most popular posts is one where you learn how you can export all the slides in your presentation to single-slide PowerPoint presentations. Although the interface for this process uses the SharePoint libary options, many more people used this feature to export single-slide presentations, without worrying about anything to do with SharePoint. Did you notice used rather than use in the previous sentence? Yes, this feature is now deprecated! If you have an older installation of PowerPoint that is not updated, this may still work for you. Otherwise, this amazing feature is dead.
Understandably, many PowerPoint users are unhappy because it’s a real pain to export hundred of slides as individual slide files. Thankfully, our good friend, Jamie Garroch from BrightCarbon has written some VBA code that will help you revive this option!
First you need to know how you can run VBA scripts in PowerPoint — then use this code. Explore the code a bit though. Also, do you see the “Option Explicit” line at the beginning of the code below? If your PowerPoint file has an existing module that already includes this line atop the code, you don’t need the first line again, and you can leave out this line from the top.
Option Explicit ' ======================================================================= ' PowerPoint VBA Macro ' ======================================================================= ' Purpose: Takes each non-hidden slide in a presentation and creates a ' single-slide presentation in the same folder as the source ' deck with the file name suffixed with the slide number. ' Example: If a three-slide active presentation is called myDeck.pptx the ' following presentation files are created: ' myDeck [slide 1].pptx ' myDeck [slide 2].pptx ' myDeck [slide 3].pptx ' Author: Jamie Garroch of BrightCarbon ' Date: 05MAR2019 ' ======================================================================= Sub ExportSlidesAsPresentations() Dim oSld As Slide ' Reference to a slide object Dim tPath As String ' Path of the active presentation Dim tFileName As String ' Filename for the output presentation Dim arrSR() As Variant ' Array of slides to be deleted Dim lIdx As Long ' Slide index counter Dim lCount As Long ' Slides array dimension Dim lSldIdx As Long ' Current slide index Dim lVisibleSlides As Long ' Total number of visible slides to export On Error GoTo errorhandler For Each oSld In ActivePresentation.Slides If Not oSld.SlideShowTransition.Hidden Then lVisibleSlides = lVisibleSlides + 1 Next If MsgBox("Depending on the number of visible slides to export and the size " & _ "of your presentation, this might take some time." & vbCrLf & vbCrLf & "Continue?", _ vbYesNo + vbQuestion, _ "Export " & lVisibleSlides & " Visible Slides to Presentations") = vbNo Then Exit Sub With ActivePresentation tPath = ActivePresentation.Path ' Export each slide as a presentation by deleting all other slides ' and the restore the slides using ctrl+z For Each oSld In .Slides If Not oSld.SlideShowTransition.Hidden Then lSldIdx = oSld.SlideIndex Erase arrSR lCount = 0 ' Get an array of all slides in the presentation except this one For lIdx = 1 To .Slides.Count If Not oSld Is .Slides(lIdx) Then ReDim Preserve arrSR(lCount) arrSR(lCount) = lIdx lCount = lCount + 1 End If Next ' Select and delete all slides except this one If ActiveWindow.ViewType = ppViewNormal Then ActiveWindow.Panes(1).Activate .Slides.Range(arrSR).Select ActiveWindow.Selection.Delete DoEvents ' Build a unique filename and save a coy of the now single-slide presentation tFileName = Left(.Name, InStrRev(.Name, ".") - 1) & " [slide " & lSldIdx & "].pptx" .SaveCopyAs tPath & "\" & tFileName, ppSaveAsOpenXMLPresentation ' Undo the slide deletion to recover all slides CommandBars.ExecuteMso "Undo" DoEvents End If Next End With ' Give feedback to the user MsgBox lVisibleSlides & " slide(s) exported to " & tPath, _ vbQuestion + vbOKOnly, "BrightCarbon - Export Complete" On Error GoTo 0 Exit Sub errorhandler: Debug.Print Err, Err.Description Resume Next End Sub
Now follow these steps:
We tested this code using PowerPoint 365 for Windows.
We used a sample presentation, shown in the folder in Figure 2.
Figure 2: Single PowerPoint file
This presentation file has 11 slides, as can be seen in Figure 3, below.
Figure 3: Eleven PowerPoint slides
We ran the macro, as explained previously in this post, and saw the message box that you can see in Figure 4, below. We clicked the Yes button.
Figure 4: Export slides
Soon, we found another message that indicates the slides were successfully exported, as can be seen in Figure 5, below.
Figure 5: Export complete
Sure enough, the folder containing the presentation now had 11 more PowerPoint files in addition to the original file (see Figure 6). These 11 presentations were all single slide presentations.
Figure 6: Exported slides
Do note though that this code works best in Normal view. Don’t try in Slide Sorter view.
Related Content: Export All Slides to Single Slide PowerPoint Presentations
You May Also Like: Jamie’s Pattern Fill Transparency Add-in for PowerPoint | PowerPoint 2013 for Developers: Conversation with Jamie Garroch
Do note that Jamie recommends the BrightSlide add-in for PowerPoint that provides a couple of variations of this feature, as can be seen in the screenshot below.
Jamie Garroch is a Technical Consultant at BrightCarbon, the specialist presentation and eLearning agency.
He develops PowerPoint automation solutions and add-ins that enable presentation authors to work smarter.
He also trains people to present more effectively using visuals and animated scenes that explain and reinforce key messages, which is supported by free resources and tips at their site.
Filed Under:
Programming
Tagged as: Jamie Garroch, Macros, Programming, VBA
Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.
Haw Can i change exporting folder (I’m using mac os)