Home > Posts > PPTmerge – merge multiple PowerPoint Presentations into a single .PPT file

PPTmerge – merge multiple PowerPoint Presentations into a single .PPT file

1) In a folder you wish (say onto the desktop one) create a subfolder named "PPTmerge".

2) At that same folder (say the desktop one) create a file named PPTmerge.vbs (or whatever filename you wish with a .vbs [=VBScript] file extension) and add the following content in it:

‘PPTmerge – merges several PowerPoint presentations (.PPT files) together
‘Author: George Birbilis (birbilis@kagi.com) / Zoomicon (www.zoomicon.com)
‘Version: 12Dec2007

Const PPTMERGE_FILE = "Merged.ppt"
Const PPTMERGE_FOLDER = ".\PPTmerge"

Dim Application
Set Application=CreateObject("PowerPoint.Application")
Application.Visible = True ‘must do this for merge to work

Dim first
first = True

Set fs=CreateObject("Scripting.FileSystemObject")
Dim folder
Set folder = fs.GetFolder(PPTMERGE_FOLDER)

Dim out

Dim ff
For Each ff in folder.Files
MsgBox ff.Name
f = PPTMERGE_FOLDER + "\" + ff.Name
If first Then
  Dim p
  Set out = Application.Presentations.Open(f)
  out.SaveAs PPTMERGE_FOLDER + "\..\" + PPTMERGE_FILE
  first = False
Else
  out.Slides.InsertFromFile f, out.Slides.Count
End If
Next
If Not first Then
out.Save
out.SlideShowSettings.Run
‘out.Close
End If
Set folder = Nothing

Set out = Nothing

Set folder = Nothing

‘Application.Quit
Set Application = Nothing

3) Then place the .PPT files you want to merge into the "PPTmerge" subfolder and double-click PPTmerge.vbs at the parent folder to launch PowerPoint, have the files merged and the presentation launched for review (the presentation file is named "Merged.ppt" and placed at the parent folder of the "PPTmerge" subfolder [e.g. on the desktop]). To enforce a certain merge order, name the files using an alphanumeric (sortable) prefix, for example "1 – Intro.ppt", "2 – Management.ppt", "3 – R&D.ppt" etc.

To remove the messagebox shown at each merge step comment out the command "MsgBox ff.Name" above, by prepending a ‘ [apostrophe] before MsgBox which will comment out that script line.

If you wish PowerPoint to close right after merging (instead of previewing the merged presentation), remove the ‘ (apostrophe), that is the whole-script-line comment char from the commands "out.Close" and "Application.Quit" and prepend the command "out.SlideShowSettings.Run" with that char (‘). Unfortunately you cannot avoid having PowerPoint application window display while merging, the command "Application.Visible = True" seems to be needed. However you could tell the powerpoint application to start minimized (use VBA editor [show the respective toolbar at PowerPoint to find it] and press F2 to see the Object Browser, then search for minimized – if you can’t find how to do it just drop me an e-mail)

For the above to work you need PowerPoint installed (tried with Office97, Office2000, OfficeXP and Office2007) and Windows Script Host (pre-installed by default at WinXP and Windows Vista, can get it from http://msdn2.microsoft.com/en-us/library/ms950396.aspx)

You can also find the above script file for download at my tranXform website

Note that if at Vista you may need to edit ".\PPTmerge" and use a full path instead (to get the path of a folder you visit it with Windows Explorer and click at the empty area near the right end of the address bar at the top of Windows Explorer Window so that the address bar shows a path like "c:\users\john\desktop\PPTmerge" that you can select and copy-paste where you wish)

Advertisements
Categories: Posts
  1. George
    2008/09/30 at 02:24

    also checkout
    http://office.microsoft.com/en-us/powerpoint/HA011587531033.aspx?ac=1&uc=1&WT.mc_id=45#CombineMult
    and
    http://office.microsoft.com/en-us/powerpoint/HP030811781033.aspx
    (the last one may be helpful if you want PPTmerge to merge multiple files with each one preserving their style, instead of all getting the style of the 1st file merged)

  2. 2013/10/31 at 20:45

    its very good. but i encountered some errors on windows 7. i removed manually. i recommend to update it.

    my corrected code

    Const PPTMERGE_FILE = "Merged.ppt"
    Const PPTMERGE_FOLDER = "D:\merg\PPTmerge"

    Dim Application
    Set Application=CreateObject("PowerPoint.Application")
    Application.Visible = True

    Dim first
    first = True

    Set fs=CreateObject("Scripting.FileSystemObject")
    Dim folder
    Set folder = fs.GetFolder(PPTMERGE_FOLDER)

    Dim out

    Dim ff
    For Each ff in folder.Files
    MsgBox ff.Name
    f = PPTMERGE_FOLDER + "\" + ff.Name
    If first Then
    Dim p
    Set out = Application.Presentations.Open(f)
    out.SaveAs PPTMERGE_FOLDER + "\..\" + PPTMERGE_FILE
    first = False
    Else
    out.Slides.InsertFromFile f, out.Slides.Count
    End If
    Next
    If Not first Then
    out.Save
    out.SlideShowSettings.Run

    End If
    MsgBox "Done"
    Set folder = Nothing

    Set out = Nothing

    Set folder = Nothing

    Set Application = Nothing

  3. anonimous
    2014/08/28 at 11:32

    Thank you….
    \

  4. fritz44
    2015/03/18 at 00:12

    Really nice code! Thank you. Saved me 1h or work. Worked with Windows 8.1 and Office 365 ProPlus.

  5. Ted Heise
    2015/10/23 at 04:07

    This was an awesome offering, thank you!

  6. 2017/04/13 at 13:53

    This is brilliant! However, when I merge ppts I end up with a load of extra slides with each line of code as the title?!!

  7. 2017/04/13 at 13:54

    It keeps adding extra slides to the end with lines of code on?!

    • 2017/04/22 at 20:54

      I probably have a newer version of it – was on my tranXform software collection, but recently had some website issues and haven’t uploaded the old content yet. Will probably move that to GitHub. If you copy-pasted from the site make sure any double quotes are the classic ASCII character that VBScript supports btw, not some other similarly looking character WordPress sometimes uses

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: