Partager via


CoAuthLocks.Add Method (Word)

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

Version Information

Version Added: Word 2010

Syntax

expression .Add(Range, Type)

expression An expression that returns a CoAuthLocks object.

Parameters

Name

Required/Optional

Data Type

Description

Range

Optional

Variant

Specifies the document range locked by the CoAuthLock object. This parameter may be a Paragraph, Column, Cell, Row, Table, Range, or Selection object.

Type

Optional

WdLockType

Specifies the type of lock. The WdLockType specified can only be wdLockEphemeral or WdLockReservation

Return Value

CoAuthLock

Remarks

The following code example adds a reservation lock to the first paragraph in the active document.

Note

By default, if no arguments are given in the call to the CoAuthLocks.Add method, a reservation lock is placed on the paragraph that contains the insertion point.

Example

ActiveDocument. CoAuthoring.Locks.Add(ActiveDocument.Paragraphs(1).Range, wdLockReservation)