CoAuthLock object (Word)

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

Remarks

Use Locks (index), where index is the index number, to return a CoAuthLock object. When adding a CoAuthLock object, use the WdLockType enumeration to specify the type of lock.

Example

The following code example returns the first lock in the active document.

Dim myLock as CoAuthLock 
 
Set myLock = ActiveDocument.CoAuthoring.Locks(1)

The following code example adds a reservation lock on the third paragraph in the active document. Reservation locks are explicitly created by a document author and are persisted across explicit save actions (locks of type wdLockEphemeral don't persist across explicit saves). You can add locks with a with a lock type of wdLockReservation using the Word ribbon. For example, you can create a reservation lock on a selected paragraph range using Block Authors on the Review tab.

ActiveDocument.CoAuthoring.Locks.Add(ActiveDocument.Paragraphs(3), wdLockReservation)

See also

Word Object Model Reference

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.