Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

CoAuthLock Object (Word)

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

Version Added: Word 2010

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.

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 do not persist across explicit saves). You can add locks with a with a lock type of wdLockReservation using the Word 2010 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)
© 2015 Microsoft