Access/VBA Library

ReusePresentation

Copies a PowerPoint presentation at the current position within the ActivePresentation . It's a extention to the Reuse Slide feature of PowerPoint.

Syntax

ReusePresentation( Source, KeepSourceFormatting )
Parameters
Name Type Description
Source String Required. Filename of the PowerPoint presentation to be copied.
KeepSourceFormatting Boolean Required. Indicates whether the CustomLayout should be copied also.
Code
Sub ReusePresentation(Source As String, ByVal KeepSourceFormatting As Boolean)
        
    Dim CurrentPresentation As Presentation
    Dim SourcePresentation As Presentation
    Dim TempFilename As String
    
    Set CurrentPresentation = ActivePresentation
    '
    ' Create copy of file avoiding reference in MRU
    '
    TempFilename = CreateTempPresentation(Source)
    '
    ' Open presentation and copy all slides
    '
    With Application_
        With .Presentations.Open(TempFilename, True, True, False)
            .Slides.Range.Copy
            .Close
        End With
        '
        ' Activate the Window
        '
        CurrentPresentation.Windows(1).Activate
        '
        ' Paste copied slides into the current presentation
        '
        On Error Resume Next
        If KeepSourceFormatting Then
            .CommandBars.ExecuteMso ("PasteSourceFormatting")
        Else
            .CommandBars.ExecuteMso ("Paste")
        End If
    End With
    '
    ' Delete temporary file
    '
    FSO.DeleteFile TempFilename
End Sub

PowerPointtag:PowerPoint

Remarks

  • This function can only be used when a Window is open for the active presentation.

See also

  • CreateTempPresentation
  • FSO