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). To use a CoAuthor class variable it first needs to be instantiated, for example
Dim car as CoAuthor
Set car = ActiveDocument.CoAuthoring.Me
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 & "."