Workbook.Password property (Excel)
Returns or sets the password that must be supplied to open the specified workbook. Read/write String.
Syntax
expression.Password
expression A variable that represents a Workbook object.
Remarks
Use strong passwords that combine uppercase and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements.
- Strong password: Y6dh!et5
- Weak password: House27
Passwords should be 8 or more characters in length. A pass phrase that uses 14 or more characters is better. It's critical that you remember your password. If you forget your password, Microsoft cannot retrieve it. Store the passwords that you write down in a secure place away from the information that they help protect.
Example
In this example, Microsoft Excel opens a workbook named Password.xls, sets a password for it, and then closes the workbook. This example assumes that a file named Password.xls exists on the C:\ drive.
Sub UsePassword()
Dim wkbOne As Workbook
Set wkbOne = Application.Workbooks.Open("C:\Password.xls")
wkbOne.Password = InputBox ("Enter Password")
wkbOne.Close
End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기