Class Conflict (Word VBA)
The class Conflict represents a conflicting edit in a co authored document. The type of a Conflict object is specified by the WdRevisionType enumeration. To use a Conflict class variable it first needs to be instantiated, for example
Dim cnf as Conflict
Set cnf = ActiveDocument.Range.Conflicts(Index:=1)
For Each
Here is an example of processing the Conflict items in a collection.
Dim cnf As Conflict
For Each cnf In ActiveDocument.Range.Conflicts
cnf.Accept
Next cnf
Accept
Accepts the user specified conflict change, and removes the conflict.
In a conflict, a user can choose either to keep or to reject the changes they have made to the content where the conflict exists. The Accept method keeps the changes that the user has made.
Dim conf As Conflict
For Each conf In ActiveDocument.CoAuthoring.Conflicts
conf.Accept
Next conf
Index
Returns a Long that represents the position of an item in a collection.
Dim lngIndex As Long
lngIndex = ActiveDocument.Range.Conflicts(1).Index
Range
Returns a Range object that represents the portion of a document that is contained in the specified object.
Dim rng As Range
Set rng = ActiveDocument.CoAuthoring.Conflicts(2).Range
Reject
Rejects the user change, removes the conflict, and accepts the server copy of the change for the conflict.
The Reject method rejects the user version of a conflict and accepts the version that is currently on the server.
Dim conf As Conflict
For Each conf In ActiveDocument.CoAuthoring.Conflicts
conf.Reject
Next conf
Type
Returns the WdRevisionTypefor the Conflict object. Here you can find possible values for
Dim con as Conflict
For Each con in ActiveDocument.CoAuthoring.Conflicts
MsgBox con.Type
Next con