Partager via


_Workbook.ProtectSharing Method

Saves the workbook and protects it for sharing.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
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)
void ProtectSharing(
    Object Filename,
    Object Password,
    Object WriteResPassword,
    Object ReadOnlyRecommended,
    Object CreateBackup,
    Object SharingPassword
)

Parameters

  • Filename
    Type: System.Object

    Optional Object. 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
    Type: System.Object

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

  • WriteResPassword
    Type: System.Object

    Optional Object. 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
    Type: System.Object

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

  • CreateBackup
    Type: System.Object

    Optional Object. True to create a backup file.

  • SharingPassword
    Type: System.Object

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

Remarks

Use strong passwords that combine upper- and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Use a strong password that you can remember so that you don't have to write it down.

See Also

Reference

_Workbook Interface

_Workbook Members

Microsoft.Office.Interop.Excel Namespace