Document.WritePassword property (Word)
Sets a password for saving changes to the specified document. Write-only String.
Syntax
expression.WritePassword
expression A variable that represents a Document object.
Remarks
Important
Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security notes for Office solution developers.
Example
If the active document isn't already protected against saving changes, this example sets "secret" as the write password for the document.
Set myDoc = ActiveDocument
If myDoc.WriteReserved = False Then myDoc.WritePassword = "secret"
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.
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin