Workbook.ProtectSharing Method (Excel)
Saves the workbook and protects it for sharing.
Syntax
식 .ProtectSharing(Filename, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, SharingPassword, FileFormat)
식 A variable that represents a Workbook object.
Parameters
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
Filename |
선택 |
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 |
선택 |
Variant |
A case-sensitive string indicating the protection password to be given to the file. Should be no longer than 15 characters. |
WriteResPassword |
선택 |
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 |
선택 |
Variant |
True to display a message when the file is opened, recommending that the file be opened read-only. |
CreateBackup |
선택 |
Variant |
True to create a backup file. |
SharingPassword |
선택 |
Variant |
A string indicating the password to be used to protect the file for sharing. |
FileFormat |
선택 |
Variant |
A string indicating the file format. |
Remarks
대문자와 소문자, 숫자 및 기호로 구성된 강력한 암호를 사용하십시오. 이러한 요소가 혼합되어 있지 않은 암호가 취약한 암호입니다. 예를 들면 강력한 암호는 Y6dh!et5이고 취약한 암호는 House27입니다. 암호 길이는 8자 이상이어야 하고, 14자 이상의 암호라면 더 좋습니다. 자세한 내용은 Help protect your personal information with strong passwords를 참조하십시오. 암호를 기억해 두는 것은 매우 중요합니다. 암호를 잊은 경우 Microsoft에서 해당 암호를 검색할 수 없습니다. 암호는 기록해서 해당 정보와 상관없는 안전한 장소에 보관해야 정보를 더욱 안전하게 보호할 수 있습니다.
Example
This example saves workbook one and protects it for sharing.
Sub ProtectWorkbook()
Dim wbAWB As Workbook
Dim strPwd As String
Dim strSharePwd As String
Set wbAWB = Application.ActiveWorkbook
strPwd = InputBox("Enter password for the file")
strSharePwd = InputBox("Enter password for sharing")
wbAWB.ProtectSharing Password:=strPwd, _
SharingPassword:=strSharePwd
End Sub