ProtectSharing Method

Applies To

Workbook object.

Description

Saves the workbook and protects it for sharing.

Syntax

expression.ProtectSharing(Filename, Password, WriteResPassword, ReadOnlyRecommended,
úCreateBackup, SharingPassword)

expression An expression that returns a Workbook object.

Filename Optional Variant. A string indicating the name of the saved file. You can include a full path; if you don't, Microsoft Excel saves the file in the current folder.

Password Optional Variant. A case-sensitive string indicating the protection password to be given to the file. Should be no longer than 15 characters.

WriteResPassword Optional Variant. A string indicating the write-reservation password for this file. If a file is saved with the password and the password isn't supplied when the file is opened, the file is opened read-only.

ReadOnlyRecommended Optional Variant. True to display a message when the file is opened, recommending that the file be opened read-only.

CreateBackup Optional Variant. True to create a backup file.

SharingPassword Optional Variant. A string indicating the password to be used to protect the file for sharing.

Example

This example saves workbook one and protects it for sharing.

Workbooks(1).ProtectForSharing Password:="drowssap", _
    SharingPassword:="gnirahs"