This documentation is archived and is not being maintained.

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

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

When you use the Information Rights Management (IRM) feature of Microsoft Office 2003 to restrict permissions to a document or workbook, by default, the code behind the Microsoft Office Word 2003 document or Microsoft Office Excel 2003 workbook is not permitted to run. You can change the default so that your managed code extensions can access the object model, and your solution will work.

You must be the author of the document or workbook or have Full Control access to be able to change the permission settings.

To permit code to run behind documents with restricted permissions

  1. Open the document or workbook in Word 2003 or Excel 2003.

  2. On the File menu, point to Permission, and then click Do Not Distribute.

  3. In the Permission dialog box, click More Options.

  4. Under Additional permissions for users, select Access content programmatically.

Word or Excel will permit programmatic access to the object model.

See Also