Application.PresentationBeforeSave event (PowerPoint)

Occurs before a presentation is saved.

Syntax

expression. PresentationBeforeSave( _Pres_, _Cancel_ )

expression A variable that represents an Application object.

Parameters

Name Required/Optional Data type Description
Pres Required Presentation The presentation being saved.
Cancel Required Boolean True to cancel the save process.

Remarks

This event is triggered as the Save As dialog box appears.

To access the Application events, declare an Application variable in the General Declarations section of your code. Then set the variable equal to the Application object for which you want to access events. For information about using events with the Microsoft PowerPoint Application object, see How to: Use Events with the Application Object.

Example

This example checks if there are revisions in a presentation, and if there are, asks whether to save the presentation. If a user's response is no, the save process is canceled. This example assumes an Application object called PPTApp has been declared by using the WithEvents keyword.

Private Sub PPTApp_PresentationBeforeSave(ByVal Pres As Presentation, _
        Cancel As Boolean)

    Dim intResponse As Integer

    Set Pres = ActivePresentation

    If Pres.HasRevisionInfo Then

        intResponse = MsgBox(Prompt:="The presentation contains revisions. " & _
            "Do you want to accept the revisions before saving?", Buttons:=vbYesNo)

        If intResponse = vbYes Then

            Cancel = True

            MsgBox "Your presentation was not saved."

        End If

    End If

End Sub

See also

Application Object

AutoSave

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.