This documentation is archived and is not being maintained.

Password Protection on Office Documents

Note Required applications

The features in this topic are available only if you have the required applications installed.

For more information, see Features Available by Product Combination.

  • One of these development environments:

    VSTO 2005


    Visual Studio Team System

  • Microsoft Office 2003

It is possible to set a password on your Microsoft Office Word 2003 documents and Microsoft Office Excel 2003 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 Microsoft Visual Studio 2005 Tools for the Microsoft Office System 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 more information on 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