Skip to content

Files

Latest commit

 

History

History
81 lines (45 loc) · 2.3 KB

PowerPoint.Application.PresentationBeforeSave.md

File metadata and controls

81 lines (45 loc) · 2.3 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Application.PresentationBeforeSave event (PowerPoint)
vbapp10.chm621018
vbapp10.chm621018
PowerPoint.Application.PresentationBeforeSave
40943fe2-796f-45db-db0d-44b66854e196
06/08/2017
medium

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

[!includeSupport and feedback]