Workbook.ProtectSharing Method (2007 System)

Saves the workbook and protects it for sharing.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
Public Sub ProtectSharing ( _
    Filename As Object, _
    Password As Object, _
    WriteResPassword As Object, _
    ReadOnlyRecommended As Object, _
    CreateBackup As Object, _
    SharingPassword As Object _
)
'Usage
Dim instance As Workbook 
Dim Filename As Object 
Dim Password As Object 
Dim WriteResPassword As Object 
Dim ReadOnlyRecommended As Object 
Dim CreateBackup As Object 
Dim SharingPassword As Object

instance.ProtectSharing(Filename, Password, _
    WriteResPassword, ReadOnlyRecommended, _
    CreateBackup, SharingPassword)
public void ProtectSharing(
    Object Filename,
    Object Password,
    Object WriteResPassword,
    Object ReadOnlyRecommended,
    Object CreateBackup,
    Object SharingPassword
)
public:
void ProtectSharing(
    Object^ Filename, 
    Object^ Password, 
    Object^ WriteResPassword, 
    Object^ ReadOnlyRecommended, 
    Object^ CreateBackup, 
    Object^ SharingPassword
)
public function ProtectSharing(
    Filename : Object, 
    Password : Object, 
    WriteResPassword : Object, 
    ReadOnlyRecommended : Object, 
    CreateBackup : Object, 
    SharingPassword : Object
)

Parameters

  • Filename
    Type: System.Object

    The name of the saved file. You can include a full path; if you do not, Microsoft Office Excel saves the file in the current folder.

  • Password
    Type: System.Object

    A case-sensitive password for the workbook. If this argument is omitted, you can unprotect the workbook without using a password. Otherwise, you must specify the password to unprotect the workbook.

  • WriteResPassword
    Type: System.Object

    The write-reservation password for this file. If a file is saved with the password and the password is not supplied when the file is opened, the file is opened read-only.

  • ReadOnlyRecommended
    Type: System.Object

    true to display a message when the file is opened, recommending that the file be opened read-only.

  • SharingPassword
    Type: System.Object

    The password to be used to protect the file for sharing.

Remarks

Use strong passwords that combine uppercase and lowercase letters, numbers, and symbols. Weak passwords do not mix these elements. For example, "Y6dh!et5" is a strong password, but "House27" is a weak password. Use a strong password that you can remember so that you do not have to write it down.

Optional Parameters

For information on optional parameters, see The Variable missing and Optional Parameters in Office Solutions.

.NET Framework Security

See Also

Reference

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace