Bagikan melalui


Password Protection on Office Documents

Applies to

The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.

Project type

  • Document-level projects

Microsoft Office version

  • Microsoft Office 2003

  • 2007 Microsoft Office system

For more information, see Features Available by Application and Project Type.

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.

You can create Visual Studio Tools for Office 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

Tasks

How to: Permit Code to Run Behind Documents with Restricted Permissions

Concepts

Document Protection in Document-Level Solutions

Information Rights Management and Managed Code Extensions Overview

Creating Office Solutions in Visual Studio