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 Excel and Word. 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.

    System_CAPS_ICON_note.jpg 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.

Information Rights Management and Managed Code Extensions Overview
Document Protection in Document-Level Solutions
Password Protection on Office Documents
Designing and Creating Office Solutions
Securing Office Solutions
Deploying an Office Solution

Show: