Udostępnij za pośrednictwem


Password protection on Office documents

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

It is possible to set a password on your Microsoft Office Word documents and Microsoft Office Excel workbooks so that they cannot be opened by someone who does not know the password. This option is called Password on Open.

Applies to: The information in this topic applies to document-level projects for Excel and Word. For more information, see Features available by Office application and project type.

You can create document-level projects using existing documents and workbooks that have Password on Open enabled. The behavior in Visual Studio is different for Word and Excel documents that have Password on Open enabled.

For information about enabling Password on Open, see Help in Word or Excel.

Behavior of Excel and Word

Every time you open an Excel workbook in Visual Studio that has Password on Open enabled, Excel prompts you for the password. When you build your solution you will be prompted for the password again, because the document is opened during build.

The first time you open a Word document in Visual Studio that has Password on Open enabled, Word prompts you for the password. After you successfully enter the password, Password on Open is removed from the document and opening the document will no longer require a password. If you want the document in your solution to require a password before it can be opened, you must enable Password on Open after your final build and before you deploy the solution.

See also