發生在儲存簡報之前。
語法
expression.
PresentationBeforeSave( _Pres_, _Cancel_ )
expression 代表 Application 物件的變數。
參數
| 名稱 | 必要/選用 | 資料類型 | 描述 |
|---|---|---|---|
| Pres | 必要 | Presentation | 所儲存的簡報。 |
| Cancel | 必要 | Boolean | True 可取消儲存程序。 |
註解
當出現 [另存新檔] 對話方塊時,會觸發這個事件。
若要存取 應用程式 事件,宣告 應用程式 變數,在您的程式碼的一般宣告區段中。 然後將您要存取事件的 應用程式 物件變數等於。 關於如何將事件與 Microsoft PowerPoint 應用程式 物件結合的資訊,請參閱 「如何:使用事件搭配應用程式物件」。
範例
此範例檢查簡報中是否有修訂,若有,則詢問是否要儲存簡報。 如果使用者的回應為否,儲存程序會取消此事件。 本範例會假設呼叫 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
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。