Class CoAuthoring (Word VBA)

Provides the primary entry point to the co authoring object model. To use a CoAuthoring class variable it first needs to be instantiated, for example


Dim cag as CoAuthoring
Set cag = ActiveDocument.CoAuthoring

Authors

Returns a CoAuthors collection that represents all the co authors currently editing the document.

The collection returned by this property is static. If this collection is stored and then new users begin editing the document, or current users are no longer editing the document, the stored collection will not change.


Dim allAuthors As CoAuthors 
Set allAuthors = ActiveDocument.CoAuthoring.Authors

CanMerge

Returns a Boolean that specifies whether the document can be auto-merged.

Only documents stored on a server that supports the File Synchronization via SOAP over HTTP protocol can be co authored, for example, SharePoint Server 2010. Additionally, a document that has the following features cannot be auto-merged:


If ActiveDocument.CoAuthoring.CanMerge Then 
    MsgBox "This document can be auto-merged." 
Else: MsgBox "This document cannot be auto-merged." 
End If

CanShare

Returns a Boolean that specifies whether this document can be co authored.

The value of this property is affected by whether CanMerge is True, the file extension is .docx, and the document is stored on a server that supports the File Synchronization via SOAP over HTTP protocol.


If ActiveDocument.CoAuthoring.CanShare Then 
    MsgBox "This document can be co authored." 
Else: MsgBox "This document cannot be co authored." 
End If

Conflicts

Returns a Conflicts collection that represents all the conflicts in a document.


Dim conf As Conflict 
 
For Each conf In ActiveDocument.CoAuthoring.Conflicts 
    MsgBox conf.Type 
Next conf 

Locks

Returns a CoAuthLocks collection that represents the locks in the document.


MsgBox "There are " & _ 
    ActiveDocument.CoAuthoring.Locks.Count & _ 
    " locks in the active document."

Me

Returns a CoAuthor object that represents the current user.


Dim coAuth As CoAuthor 
 
Set coAuth = ActiveDocument.CoAuthoring.Me 
MsgBox "The current user has " & coAuth.Locks.Count & _ 
" locks in the active document."

PendingUpdates

Returns True if the document has pending updates that have not been accepted.


If ActiveDocument.CoAuthoring.PendingUpdates Then 
MsgBox "There are content updates pending." 
Else: MsgBox "There are no pending updates." 
End If

Updates

Returns a CoAuthUpdates collection that represents the most recent updates that were merged into the document.


Dim allUpdates As CoAuthUpdates 
 
Set allUpdates = ActiveDocument.CoAuthoring.Updates