Class CoAuthor (Word VBA)

The class CoAuthor represents a single co author in the document. The CoAuthor object is a member of the CoAuthors collection. The CoAuthors collection contains all the co authors in the document (authors that are actively editing the document).

Set

To use a CoAuthor class variable it first needs to be instantiated, for example

Dim car as CoAuthor
Set car = ActiveDocument.CoAuthoring.Me

The following procedures can be used to set variables of type CoAuthor: CoAuthLock.Owner, CoAuthoring.Me, CoAuthors.Item, Comment.Contact and CoAuthoring.Authors

For Each

Here is an example of processing the CoAuthor items in a collection.

Dim carAuthor As CoAuthor
For Each carAuthor In ActiveDocument.Authors
	
Next carAuthor

EmailAddress

Returns a string that specifies the email address of the specified co author.

If ActiveDocument.CoAuthoring.Authors.Count <> 0 Then 
 MsgBox ActiveDocument.CoAuthoring.Authors(1).EmailAddress 
Else
 MsgBox "There are no co authors in this document."
End If 
 

ID

Returns a String that specifies a unique identifier for the specified author.

The unique identifier returned by the ID property should not be assumed to have a particular length or format.

Dim allAuthors As CoAuthors 
Dim coAuth As CoAuthor 
 
Set allAuthors = ActiveDocument.CoAuthoring.Authors 
 
For Each coAuth In allAuthors 
 MsgBox "The ID for " & _ 
 coAuth.Name & " is " & coAuth.ID & "." 
Next coAuth

IsMe

Returns true if this author represents the current user.

If ActiveDocument.CoAuthoring.Authors(1).IsMe Then 
MsgBox "The current user is the first coauthor." 
End If

Locks

Returns a CoAuthLocks collection that represents the locks in the document that are associated with the specified co author.

Dim lockCount As Integer 
Dim coAuth As CoAuthor 
 
Set coAuth = ActiveDocument.CoAuthoring.Authors(1) 
lockCount = coAuth.Locks.Count 
 
MsgBox "There are " & lockCount & _ 
 " locks in the active document for " & _ 
 coAuth.Name & "."

Name

Returns a String that contains the display name of the specified co author.

Set coAuth = ActiveDocument.CoAuthoring.Authors(1) 
MsgBox "The name of the user is " & _ 
coAuth.Name & "."

Parent

Returns an object that represents the parent object of the specified CoAuthor object.

Dim objParent As Object
Set objParent = ActiveDocument.CoAuthoring.Me.Parent

CoAuthors.Count

Returns the number of items in the CoAuthors collection.

MsgBox "The active document contains " & _ 
 ActiveDocument.CoAuthoring.Authors.Count & " authors."

CoAuthors.Item

Returns an individual CoAuthor object in a collection.

Syntax : expression.Item (Index)

Index: The individual object to be returned.

Dim car As CoAuthor
Set car = ActiveDocument.CoAuthoring.Authors(Index:=1)

CoAuthors.Parent

Returns an object that represents the parent object of the specified CoAuthors object.

Dim objParent As Object
Set objParent = ActiveDocument.CoAuthoring.Authors.Parent