SaveEventArgs Class (2007 System)

Provides data for the BeforeSave event.

This API is not CLS-compliant. 

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
<CLSCompliantAttribute(False)> _
<PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _
Public Class SaveEventArgs _
    Inherits CancelEventArgs
'Usage
Dim instance As SaveEventArgs
[CLSCompliantAttribute(false)]
[PermissionSetAttribute(SecurityAction.Demand, Name = "FullTrust")]
public class SaveEventArgs : CancelEventArgs
[CLSCompliantAttribute(false)]
[PermissionSetAttribute(SecurityAction::Demand, Name = L"FullTrust")]
public ref class SaveEventArgs : public CancelEventArgs
public class SaveEventArgs extends CancelEventArgs

Examples

The following code example demonstrates an event handler for the BeforeSave event. When you save the document, the event handler prompts you to cancel or continue with the save operation.

This example is for a document-level customization.

Private Sub DocumentBeforeSave()
    AddHandler Me.BeforeSave, AddressOf ThisDocument_BeforeSave
End Sub 

Private Sub ThisDocument_BeforeSave(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Word.SaveEventArgs)
    If MessageBox.Show("Do you want to save the document?", "BeforeSave", _
        MessageBoxButtons.YesNo) = DialogResult.No Then
        e.Cancel = True 
    End If 
End Sub
private void DocumentBeforeSave()
{
    this.BeforeSave += new Microsoft.Office.Tools.Word.SaveEventHandler(ThisDocument_BeforeSave);
}

void ThisDocument_BeforeSave(object sender, Microsoft.Office.Tools.Word.SaveEventArgs e)
{
    if (MessageBox.Show("Do you want to save the document?", "BeforeSave",
        MessageBoxButtons.YesNo) == DialogResult.No)
    {
        e.Cancel = true;
    }
}

Inheritance Hierarchy

System.Object
  System.EventArgs
    System.ComponentModel.CancelEventArgs
      Microsoft.Office.Tools.Word.SaveEventArgs

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

SaveEventArgs Members

Microsoft.Office.Tools.Word Namespace