How to merge multiple powerpoint files into one file?

10,680

Yes, you can, but you can't do it with Binary Appending.

Why...??
Because a CSV is a comma separated values file, which allows data to be saved in a table structured format. CSVs look like a garden-variety spreadsheet but with a .csv extension. So when you append them, you can still use them in excel. But .pptx have different formats that are not so simple. hence Binary appending won't work.

The following code will insert all slides from all presentations in the same folder as the currently active presentation (but won't try to insert slides from the current presentation into itself). (Personally Tested)

Follow the steps:

  1. Create a New Folder.
  2. For appending Mutiple Files, Save the current file in the new folder in which you want to insert slides from other files.

  3. Copy all the other .pptx or .ppt files to the new folder Open the document in which you want to add files.

  4. Now Press ALT+F11 to start the VBA editor.

  5. Or choose File | Options | Customize Ribbon and put a checkmark next to Developer in the listbox under Customize Ribbon. Close the options dialog box, click the Developer tab then click Visual Basic to start the editor.

  6. In the VBA editor, make sure that your presentation is highlighted in the left-hand pane.
    Choose Insert, Module from the menu bar to insert a new code module into your project.

  7. Paste this Code & Change "*.PPT" to "*.PPTX" or whatever if necessary

    Sub InsertAllSlides()
    '  Insert all slides from all presentations in the same folder as this one
    '  INTO this one; do not attempt to insert THIS file into itself, though.
    
        Dim vArray() As String
        Dim x As Long
    
        ' Change "*.PPT" to "*.PPTX" or whatever if necessary:
        EnumerateFiles ActivePresentation.Path & "\", "*.PPT", vArray
    
        With ActivePresentation
            For x = 1 To UBound(vArray)
                If Len(vArray(x)) > 0 Then
                    .Slides.InsertFromFile vArray(x), .Slides.Count
                End If
            Next
        End With
    
    End Sub
    
    Sub EnumerateFiles(ByVal sDirectory As String, _
        ByVal sFileSpec As String, _
        ByRef vArray As Variant)
        ' collect all files matching the file spec into vArray, an array of strings
    
        Dim sTemp As String
        ReDim vArray(1 To 1)
    
        sTemp = Dir$(sDirectory & sFileSpec)
        Do While Len(sTemp) > 0
            ' NOT the "mother ship" ... current presentation
            If sTemp <> ActivePresentation.Name Then
                ReDim Preserve vArray(1 To UBound(vArray) + 1)
                vArray(UBound(vArray)) = sDirectory & sTemp
            End If
            sTemp = Dir$
        Loop
    
    End Sub
    
  8. To make sure there are no serious syntax problems with the code, choose Debug, Compile from the menu bar.
  9. If there is an error check the code again, else click the Run button.
  10. the Slides will be added to the opened document.

NOTE : Background Pictures & some other elements are not added when slides are added from another file.

See & Learn More From :

Share:
10,680

Related videos on Youtube

surfmuggle
Author by

surfmuggle

Updated on September 18, 2022

Comments

  • surfmuggle
    surfmuggle over 1 year

    Is there an easy way to combine multiple powerpoint files into one single file?

    Under ms dos for binary files you can copy them using /b or according to this SO question just use copy

     copy /b <source1> + <source2> [....] <targetfile>
     // or
     copy *.csv new.csv
    

    I tried the later copy *.pptx new.pptx but this did not work - the resulting pptx was empty. The first approach using copy /b requires to enter each file name which is cumbersome and i did not try.

    Do you have any ideas how i could sovle this?

    • AirPett
      AirPett almost 8 years
      Is it an option to do this by hand? Since there is a function for doing this inside PowerPoint.
    • surfmuggle
      surfmuggle almost 8 years
      Depends how comfortable it is - can i select multiple files at once or do i have to iterate the steps for each file?
    • AirPett
      AirPett almost 8 years
      According to this you have to do it manually for each file. But if you're not going to edit the big presentation after creating it, the easiest way would be to convert all files to PDF (you can find a tool that does that for 100 files automatically) and then combine those PDF-files as one big file (done that a thousand times with i.e. Adobe Acrobat)
  • surfmuggle
    surfmuggle almost 8 years
    Thanks for your reply. In powerpoint 2013 this has to be repeated for every file. I am looking to do it in a loop for n files at once.
  • Sudipta Biswas
    Sudipta Biswas almost 8 years
    Try the macro technique. Given at the bottom.
  • Sudipta Biswas
    Sudipta Biswas almost 8 years
    See I re-edited the whole thing, It works Confirmed my testing it.
  • Sudipta Biswas
    Sudipta Biswas almost 8 years
    See you can use this one too, But I am getting some errors while compiling it stackoverflow.com/questions/5316459/…