Muokkaa

Jaa


Selection.NextRevision method (Word)

Locates and returns the next tracked change as a Revision object.

Syntax

expression. NextRevision( _Wrap_ )

expression Required. A variable that represents a Selection object.

Parameters

Name Required/Optional Data type Description
Wrap Optional Variant True to continue searching for a revision at the beginning of the document when the end of the document is reached. The default value is False.

Return value

Revision

Remarks

The changed text becomes the current selection. Use the properties of the resulting Revision object to see what type of change it is, who made it, and so forth. Use the methods of the Revision object to accept or reject the change.

If there are no tracked changes to be found, the current selection remains unchanged.

Example

This example rejects the next tracked change found after the fifth paragraph in the active document. The revTempvariable is set to Nothing if a change is not found.

Dim rngTemp as Range 
Dim revTemp as Revision 
 
If ActiveDocument.Paragraphs.Count >= 5 Then 
 Set rngTemp = ActiveDocument.Paragraphs(5).Range 
 rngTemp.Select 
 Set revTemp = Selection.NextRevision(Wrap:=False) 
 If Not (revTemp Is Nothing) Then revTemp.Reject 
End If

This example accepts the next tracked change found if the change type is inserted text.

Dim revTemp as Revision 
 
Set revTemp = Selection.NextRevision(Wrap:=True) 
If Not (revTemp Is Nothing) Then 
 If revTemp.Type = wdRevisionInsert Then revTemp.Accept 
End If

This example finds the next revision after the current selection made by the author of the document.

Dim revTemp as Revision 
Dim strAuthor as String 
 
strAuthor = ActiveDocument.BuiltInDocumentProperties(wdPropertyAuthor) 
 
Do While True 
 Set revTemp = Selection.NextRevision(Wrap:=False) 
 If Not (revTemp Is Nothing) Then 
 If revTemp.Author = strAuthor Then 
 MsgBox Prompt:="Another revision by " & strAuthor & "!" 
 Exit Do 
 End If 
 Else 
 MsgBox Prompt:="No more revisions!" 
 Exit Do 
 End If 
Loop

See also

Selection Object

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.