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
Open the document or workbook in Word or Excel.
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.
In the Permission dialog box, select Restrict permission to this document, and then click More Options.
Under Additional permissions for users, select Access content programmatically.
Word or Excel will permit programmatic access to the object model.