Share via


CustomXMLParts.PartBeforeDelete Event

Office Developer Reference

Occurs just before a CustomXMLPart object is deleted from the CustomXMLParts collection.

Aa433594.vs_note(en-us,office.12).gif  Note
References to DTDs from custom XML parts are not supported. DTD references in custom XML parts will not resolve, and custom XML parts containing DTD references generate an exception when an attempt is made to save the file's content to a flat XML file.

Syntax

expression.PartBeforeDelete(OldPart, )

expression   An expression that returns a CustomXMLParts object.

Parameters

Name Required/Optional Data Type Description
OldPart Required CustomXMLPart The part that is about to be deleted.

Example

The following example confirms that the user wants to delete the customXML part and then deletes the part if the user clicks Yes in the dialog box.

Visual Basic for Applications
  Sub CustomXMLParts_PartBeforeDelete(ByVal oldPart As CustomXMLPart)
Dim result As Boolean

result = MsgBox("Are you sure you want to delete the " & oldPart.ID & " part?", vbYesNo)

If result Then oldPart.Delete End If

End Sub

See Also