Microsoft Dynamics 365 Blog

Document handling in Dynamics AX is a very flexible way to create nice looking Microsoft Office Word documents where Bookmarks in Word are replaced with data from Dynamics AX. Microsoft Office Word on the other hand offers with Form Controls like DropDown Lists nice functionality let users individually customize the Word documents for the given purpose, by also limiting the user to given set of possiblities.

When you now want to use both Dynamics AX Document Handling with a Microsoft Office Word document that uses Form Controls, you run into an either or situation: In order for Form Controls to “work” Document Protection has to be enabled for the Document Template. If Document Protection is however enabled, Dynamics AX Document Handling cannot replace Bookmarks in the protected areas.

If you try to use a protected document with Document Handling you will see the following error message:

Method ‘insertAfter’ in COM object of class ‘Range’ returned error code 0x800A11FD (<unknown>) which means.: This method or property is not available because the object refers to a protected area of the document”.

The error message here is raised by Microsoft Office Word. Dynamics AX Document Handling is not filling text fields (Bookmarks) but replacing them and this modification is not allowed in a protected document.

But, Microsoft Office Word offers the possibility to enable document protection only to certain sections of a document. So you can place Bookmarks used by Dynamics AX in a section that is kept unprotected and the Form Controls in a section where Document Protection is enabled.

The following description is based on Microsoft Office Word 2007, but you can do the same with earlier versions of Microsoft Office Word, you just have to find out the correct Menu Items…

  1. First Remove Document Protection
    • Start Microsoft Office Word 2007 and open the Document Template for modification (don’t create a document based on the template)
    • Select the “Review” Ribbon
    • In the group “Protect” click at “Protect Document” and select “Restrict Formatting and Editing”
    • In the now visible Taskarea “Restrict Formatting and Editing” click at the “Stop Protection” button
  2. Next Insert a Section Break
    • Click in the line you want to enter the section break
    • Select the “Page Layout” Ribbon
    • In the group “Page Setup” click at “Breaks” and select “Continuous”
  3. Turn Document Protection back on
    • In the (still visible) Taskarea “Restrict Formatting and Editing” click at the now existing link “Select sections…” under point 2
    • Select only “Section 2” as a protected section by removing the checkbox for “Section 1” and click OK
    • Click at the “Yes, Start Enforcing Protection” button and click OK (don’t enter a password)

You have now configured a section based Document Protection, where Dynamics AX is able to insert the bookmarks in the unprotected Section 1 and where you are able to use Form Controls in the protected Section 2.

–author: Alexander Lachner
–editor: Alexander Lachner
–date: 23/04/2009

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!