Application.XMLSelectionChange event (Word)
Occurs when the parent XML node of the current selection changes.
Syntax
expression.XMLSelectionChange'(Sel**, OldXMLNode, NewXMLNode, Reason)
expression A variable that represents an 'Application' object that has been declared in a class module by using the WithEvents keyword. For more information about using events with the Application object, see Using events with the Application object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Sel | Required | Selection | The text selected, including XML elements. If no text is selected, the Sel parameter returns either nothing or the first character to the right of the insertion point. |
OldXMLNode | Required | XMLNode | The XML node from which the insertion point is moving. |
NewXMLNode | Required | XMLNode | The XML node to which the insertion point is moving. |
Example
The following example validates a newly added XML element when a new element is inserted into the document.
Private Sub Wrd_XMLSelectionChange(ByVal Sel As Selection, _
ByVal OldXMLNode As XMLNode, ByVal NewXMLNode As XMLNode, _
Reason As Long)
Dim intResponse As Integer
If Reason = wdXMLSelectionChangeReasonInsert Then
If Not NewXMLNode Is Nothing Then
NewXMLNode.Validate
End If
End If
End Sub
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기