PresentationBeforeSave 事件

       

保存演示文稿前发生此事件。

Private Sub object_PresentationBeforeSave(ByVal Pres As Presentation, Cancel As Boolean)

object 变量。该变量引用在类模块中以事件方式声明的 Application 类型的对象。

Pres 将被保存的演示文稿。

Cancel 该参数为 True 时,取消保存过程。

说明

此事件在“另存为”对话框出现时触发。

若要访问 Application 事件,请在代码的通用声明部分中声明一个 Application 变量。然后将此变量设置为要访问其事件的 Application 对象。有关使用 Microsoft PowerPoint Application 对象的事件的信息,请参阅使用 Application 对象的事件

示例

本示例检查演示文稿中是否存在改动。如果存在改动,会询问是否保存演示文稿。如果用户的答复为不保存,将取消此保存过程。本示例假定一个称为 PPTApp 的 Application 对象已使用 WithEvents 关键字进行声明。

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