Class CoAuthLock (Word VBA)

The class CoAuthLock represents a lock within the document. The CoAuthLock object is a member of the CoAuthLocks collection.

The main procedure of class CoAuthLock is CoAuthLocks.Add

Set

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

Dim cal as CoAuthLock
Set cal = ActiveDocument.Range.Locks(Index:=1)

The following procedures can be used to set variables of type CoAuthLock: CoAuthLocks.Add, CoAuthLocks.Item, CoAuthor.Locks, CoAuthoring.Locks and Range.Locks

For Each

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

Dim cal As CoAuthLock 
For Each cal In ActiveDocument.CoAuthoring.Locks 
    If cal.Type = wdLockReservation Then cal.Unlock 
Next cal

Methods

This is the main method of the CoAuthLock class

CoAuthLocks.Add - Returns a CoAuthLock object that represents a lock added to a specified range.

Dim cal As CoAuthLock
Set cal = ActiveDocument.Range.Locks.Add()

Properties

HeaderFooter this object or member has been deprecated. You should not use it in new applications.

Dim booHeaderFooter As Boolean
booHeaderFooter = ActiveDocument.Range.Locks(1).HeaderFooter

Owner

Dim carOwner As CoAuthor
Set carOwner = ActiveDocument.Range.Locks(1).Owner

Parent returns an object that represents the parent object of the specified CoAuthLock object.

Dim objParent As Object
Set objParent = ActiveDocument.Range.Locks(1).Parent

Range returns a Range object that represents the portion of a document that is contained in the specified object.

Dim rngRange As Range
Set rngRange = ActiveDocument.Range.Locks(1).Range

Type returns a WdLockType constant that specifies the lock type.

Dim wltType As WdLockType
wltType = ActiveDocument.Range.Locks(1).Type

CoAuthLocks.Count returns a Long that represents the number of locks in the CoAuthLocks collection.

Dim lngCount As Long
lngCount = ActiveDocument.Range.Locks.Count

CoAuthLocks.Parent returns an object that represents the parent object of the specified CoAuthLocks object.

Dim objParent As Object
Set objParent = ActiveDocument.Range.Locks.Parent