Protection for generated documents is a common query from our customers. With DocX and Macros it is very simple to achieve this.
Open the template, add the following Macro to the template and save it with the file extension .Docm.
Sub DCPMacro() ActiveDocument.Protect Password:="password", NoReset:=True, Type:=wdAllowOnlyReading, _ UseIRM:=False, EnforceStylelock:=False End Sub
This Macro will ensure that the created document is protected with a password.
The DCPMacro will be called after generating the document.
Other macros you could use are:
Macro-Name | when will it will be called from the code |
DocumentsCorePackMacroBeforeCreateActivity
|
this macro will be called before the activity is written to CRM |
DocumentsCorePackMacroAfterCreate
|
this macro will be called after the activity is successfully created |
Example:
If you want the Document Information Panel to be visible, you could add the following Macro (which will be executed before the activity is created and saved):
Sub DocumentsCorePackMacroBeforeCreateActivity() With Application .DisplayDocumentInformationPanel = Not .DisplayDocumentInformationPanel End With End Sub
Here is an example template for the entity account:
DocumentInformationPanel.docm (26.02 kb)
That’s it! We appreciate your feedback! Please share your thoughts by sending an email to support@mscrm-addons.com.
reworkneeded