Share via


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

You can use the Information Rights Management (IRM) feature of Microsoft Office to restrict permissions to a document or workbook. By default, the code behind a restricted Microsoft Office Word document or Microsoft Office Excel 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.

Applies to: The information in this topic applies to document-level projects for the following applications: Excel 2013 and Excel 2010; Word 2013 and Word 2010. For more information, see Features Available by Office Application and Project Type.

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 or Excel.

  2. Click the File tab, point to Prepare, point to Restrict Permission, and then click Restricted Access.

    Note

    On first use, you are prompted to install the Windows Rights Management client. After you install the client, you might need to repeat the steps.

  3. In the Permission dialog box, select Restrict permission to this document, and then 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

Concepts

Information Rights Management and Managed Code Extensions Overview

Document Protection in Document-Level Solutions

Password Protection on Office Documents

Other Resources

Designing and Creating Office Solutions

Securing Office Solutions

Deploying an Office Solution