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

*UPDATE* Here’s the download link to a new version of my PowerPoint template with VBA Macro, updated to auto generate hyperlinks and summary pages for your PowerPoint 2010 slide decks.

In my first post on creating Auto Summary Slides for PowerPoint 2010, I gave you a VBA macro and PowerPoint template showing how to create summary slides based upon the titles of those selected with one mouse click.

By popular demand, I’ve added an extra feature to the Macro. You now have two choices: either have the original behaviour of a text-only summary page, or use the new extended version that makes every summary item a hyperlink to the original slide.

Once again, I’m making this free under the Creative Commons Public Domain license.

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(Optional CreateHyperlinks As Boolean)

  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:         

  51:         ' By popular demand...! ;)

  52:         If CreateHyperlinks Then

  53:             'Add Hyperlinks :)

  54:             For o = 1 To UBound(slideOrder)

  55:                 If ActivePresentation.Slides(slideOrder(o) + 1).Shapes.HasTitle Then

  56:                     'Build up the ToC Text

  57:                     strTitle = ActivePresentation.Slides(slideOrder(o) + 1).Shapes.Title.TextFrame.TextRange.Text

  58:                     With summary.Shapes(2).TextFrame.TextRange.Paragraphs(o).ActionSettings(ppMouseClick)

  59:                         .Action = ppActionHyperlink

  60:                         .Hyperlink.Address = ""

  61:                         .Hyperlink.SubAddress = ActivePresentation.Slides(slideOrder(o) + 1).SlideID & "," & ActivePresentation.Slides(slideOrder(o) + 1).SlideIndex & "," + strTitle

  62:                     End With

  63:                 End If

  64:             Next

  65:         End If

  66:     End If

  67: End Sub

  68:  

  69: '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  70: ''' InsertSummaryWithHyperlinks()

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

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

  73: ''' (and probably 2007 too!) with Hyperlinks

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

  75: ''' this macro.

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

  77: '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

  78: Sub InsertSummaryWithHyperlinks()

  79:     InsertSummary CreateHyperlinks:=True

  80: End Sub

To the extent possible under law, Joel Jeffery has waived all copyright and related or neighbouring rights to InsertSummary() and InsertSummaryWithHyperlinks() Macros 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!

Technorati Tags: Macro, PowerPoint 2010, VBA

 

You can leave a response, or trackback from your own site.

7 Responses to “Auto Summary Slides for PowerPoint 2010 VBA Macro with Hyperlinks! Free!”

  1. Guru says:

    This is nice algorithm. However, while using it, I encountered an error at
    “QSortInPlace slideOrder” command. Can you please help – this command is not recognized…

  2. Yourane Ung says:

    Hi ! And let me first thank you for this very useful macro !

    I may have a few idea to make it even better :

    - is it possible to include the section names in a second text level ?
    - is it possible to call a particular slide layout when creating the summary slide (instead of the default title and text layout) ?

    Thanks in advance !
    Yourane.

  3. Pete says:

    Okay, I really like how these macros work on simple PowerPoint slide decks (I am currently running Office 2003). However, I have slidedecks that range from 80-170 slides for workshops that I am involved in. I attempted to execute the macro against some of those files but it failed with the dialog box: Run-time error -21471881670 (80048240): TextFrame (unknown member) : Invalid request. This type of shape cannot have a TextRange.

    The debugger stops at: strTitle = ActivePresentation.Slides(slideOrder(o)).Shapes.Title.TextFrame.TextRange.Text

    Do you have any ideas on this one? Some of the slides/headers are not text would this affect the macro? Thanks for posting…

  4. Adrienne says:

    Macro worked a charm!! Anyway to code the macro so that it also display page numbers?

  5. Cindy says:

    I’m not a geek. How do it install it?

  6. Sybarite says:

    This is great! Thank you!
    Once i actually read the directions it was easy to use!

Leave a Reply