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
Here is an example of processing the CoAuthor items in a collection.
Dim carAuthor As CoAuthor For Each carAuthor In ActiveDocument.Authors Next carAuthor
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
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
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
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 & "."
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 & "."
Returns an object that represents the parent object of the specified CoAuthor object.
Dim objParent As Object Set objParent = ActiveDocument.CoAuthoring.Me.Parent
Returns the number of items in the CoAuthors collection.
MsgBox "The active document contains " & _ ActiveDocument.CoAuthoring.Authors.Count & " authors."
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)
Returns an object that represents the parent object of the specified CoAuthors object.
Dim objParent As Object Set objParent = ActiveDocument.CoAuthoring.Authors.Parent