Sets a write-reservation password on the Workbook, so Excel prompts for the modify password or offers to open the file read-only
Syntax
procedure SetModifyPassword(PassWord: Widestring; RecommendReadOnly: boolean; UserName: Widestring);
| PassWord |
Required Widestring. The write-reservation password. An empty string clears an existing reservation |
| RecommendReadOnly |
Required Boolean. True to have Excel recommend opening the file as read-only when the correct password is not supplied |
| UserName |
Required Widestring. The name of the user who currently holds the write reservation, shown by Excel in the password prompt |
Remarks
This is a write-reservation (FILESHARING) password, distinct from the workbook open password and from
Protect/
UnProtect structure protection. After a successful call,
IsWriteReserved returns True
Example
This example reserves the Workbook for editing by "Alice", recommending read-only access to anyone without the password
Workbook.SetModifyPassword('mypass123', true, 'Alice');