DocumentEvents2_XMLBeforeDeleteEventHandler Delegate 

A Delegate type used to add an event handler for the XMLBeforeDelete event. The XMLBeforeDelete event occurs when a user deletes an XML element from a document.

Namespace: Microsoft.Office.Interop.Word
Assembly: Microsoft.Office.Interop.Word (in microsoft.office.interop.word.dll)

Usage

Sub Sub1(DeletedRange As Range, _
    OldXMLNode As XMLNode, _
    InUndoRedo As Boolean)
End Sub
Dim documentEvents2_XMLBeforeDeleteEventHandler1 As New DocumentEvents2_XMLBeforeDeleteEventHandler(AddressOf Sub1)

Syntax

Public Delegate Sub DocumentEvents2_XMLBeforeDeleteEventHandler( _
    <InAttribute()> ByVal DeletedRange As Range, _
    <InAttribute()> ByVal OldXMLNode As XMLNode, _
    <InAttribute()> ByVal InUndoRedo As Boolean _
)
public delegate void DocumentEvents2_XMLBeforeDeleteEventHandler(
    [In] Range DeletedRange, 
    [In] XMLNode OldXMLNode, 
    [In] bool InUndoRedo
);
public delegate Void DocumentEvents2_XMLBeforeDeleteEventHandler(
    Range^ DeletedRange, 
    XMLNode^ OldXMLNode, 
    Boolean InUndoRedo
);
public delegate void DocumentEvents2_XMLBeforeDeleteEventHandler(
    /*in*/Range DeletedRange, 
    /*in*/XMLNode OldXMLNode, 
    /*in*/boolean InUndoRedo
);
In JScript, you can use the delegates in the .NET Framework, but you cannot define your own.

Parameters

  • DeletedRange
    Range object. The contents of the XML element being deleted. If only an element is deleted and not associated text, the DeletedRange parameter will not exist and will, therefore, be set to Nothing.
  • OldXMLNode
    XMLNode object. The node that is being deleted.
  • InUndoRedo
    Boolean. True indicates the action was performed using the Undo or Redo feature in Microsoft Word.

Remarks

If the InUndoRedo parameter is True, never change the XML in a document while the XMLAfterInsert and XMLBeforeDelete events are running.

If the InUndoRedo parameter is False, you can insert and delete the XML in the document— but be careful that the XMLAfterInsert and XMLBeforeDelete events will not try to cancel each other out, causing an infinite loop. You can prevent infinite loops by using a global Boolean variable and check for that at the beginning of the error handler.

Platforms

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000

Target Platforms

See Also

Reference

Microsoft.Office.Interop.Word Namespace