Joel's SharePoint Architect Blog

SharePoint 2010, MOSS & WSS Tips and Consultancy Tales

Subscribe Subscribe  View Joel Jeffery's profile on LinkedIn
joelblogs.co.uk | joelj.co.uk | joeljeffery.co.uk | jfdiphoenix.co.uk

Category : Code Samples and Downloads

*UPDATE* Please see part two of this blog post for an updated version that creates a auto summary slides for PowerPoint 2010 with hyperlinks!

Download the Create Summary Slide Macro PowerPoint 2010 slide deck here.

Not strictly SharePoint Architect related, but I cooked this VBA script up whilst working on my latest SharePoint 2010 Developer courseware.

In PowerPoint 2003 and earlier there was a button you could press that would automagically create a Summary Slide or Table of Contents Slide for you based upon slides you’d selected in Slide Sorter.

It got taken away in PowerPoint 2007, and it’s still missing in 2010! So tonight I wrote this macro. Apologies for any errors. It’s very, very late.

Creative Commons Zero - CC0

   1: '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

   2: ''' InsertSummary()

   3: ''' by Joel Jeffery (http://joelblogs.co.uk) August 2010

   4: ''' Creates a Summary Slide for PowerPoint 2010

   5: ''' (and probably 2007 too!)

   6: ''' Depends: Requires QSortInPlace by Chip Pearson

   7: ''' Usage: Select Slides (e.g. in Slide Sorter) and run

   8: ''' this macro.

   9: ''' License: Creative Commons Public Domain 2010

  10: '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  11: Sub InsertSummary()

  12:     Dim i As Integer

  13:     Dim strSel As String, strTitle As String

  14:     Dim summary As Slide

  15:     

  16:     'Only run if we've got something selected

  17:     If ActiveWindow.Selection.SlideRange.Count > 0 Then

  18:         'Array to hold the order of the slides...

  19:         'We do this or we build the ToC in the order

  20:         'in which the slides were selected :)

  21:         Dim slideOrder() As Integer

  22:         

  23:         'Size this to the number of slides selected

  24:         ReDim slideOrder(1 To ActiveWindow.Selection.SlideRange.Count)

  25:         

  26:         'Collect all the IDs of the selected slides

  27:         For i = 1 To ActiveWindow.Selection.SlideRange.Count

  28:             slideOrder(i) = ActiveWindow.Selection.SlideRange(i).SlideIndex

  29:         Next

  30:         

  31:         'Sort them with the QSort Algorithm

  32:         'By Chip Pearson, www.cpearson.com, chip@cpearson.com

  33:         QSortInPlace slideOrder

  34:                 

  35:         'Iterate over the slides in Index order

  36:         For o = 1 To UBound(slideOrder)

  37:             If ActivePresentation.Slides(slideOrder(o)).Shapes.HasTitle Then

  38:                 'Build up the ToC Text

  39:                 strTitle = ActivePresentation.Slides(slideOrder(o)).Shapes.Title.TextFrame.TextRange.Text

  40:                 strSel = strSel & strTitle & vbCrLf

  41:             End If

  42:         Next

  43:         

  44:         'Create the summary slide before the first slide in the selection

  45:         Set summary = ActivePresentation.Slides.Add(slideOrder(1), ppLayoutText)

  46:         'Add the title

  47:         summary.Shapes(1).TextFrame.TextRange = "Module Summary"

  48:         'Add the ToC text

  49:         summary.Shapes(2).TextFrame.TextRange = strSel

  50:     End If

  51: End Sub

  52:  

To the extent possible under law, Joel Jeffery has waived all copyright and related or neighbouring rights to InsertSummary() Macro for PowerPoint 2010. This work is published from United Kingdom. Why am I bothering to licensed this under Creative Commons? Because some folks are selling similar functionality as a PowerPoint Add-In and I think it should be free. Enjoy!

You’ll also need the QSortInPlace method by Chip Pearson.

To use, simply select all the slides you want to use for your summary (for instance, in Slide Sorter view) and run the InsertSummary() macro.

PowerPoint 2010 Slide Sorter

Here’s the result:

PowerPoint Automatic Summary Page

One bullet point bearing the title of each slide you include.

Enjoy!

Technorati Tags: Macro, PowerPoint 2010, VBA