2. April 2014 14:34

Macros in DocumentsCorePack and AutoMerge templates

Filed Under(CRM 2011 | DocumentsCorePack 2011 | CRM 2013 | DocumentsCorePack 2013) By Jin

This article outlines how to run a macro

Requirments: DocumentsCorePack v4.20 and higher, WordMailMerge v2.80 and higher

...


MACRO OVERVIEW

 Macro-Name

Format / Addon
DCPMacro only .docm / DCP 2011 and DCP 2013
DocumentsCorePackMacroAfterCreate .dot and .docx from WMM 3.0 to DCP 2013*
DocumentsCorePackMacroAfterDatasourceLoaded only .dot from WMM 3.0 to DCP 2013*
DocumentsCorePackMacro .dot and .docx from WMM 3.0 to DCP 2013*

 

 

 

 

 

 

 

 

* These macros are obsolet!

NOTE: All macros only work for DocumentsCorePack client-side document generation!

Below you will find a step-by-step description of how to add such a macro to a new or an existing template.

HOW TO: Add a macro to a new or an existing template, step-by-step description


1.
Open Microsoft Office Word
2. Press the „Open Template“ button of the WMM/DCP Add-on

Attention: If you are opening an existing template always use the „Open Template“ button, do not use the double click or „New document with this template“ button (which is the same) otherwise there could be problems with references of the documents.

3. Or create a new Template (see: DocumentsCorePack Client User Guide)
4. To access the Visual Basic Editor press [Alt] + [F11]
5. Now Select „ThisDocument“ of the document where you want to add the macro

Again here the two points where you can look up to WordMailMerge or DocumentsCorePack:

  • If you merge a single document and automatically merge to new document is activated, or you confirm if you are asked for it. In this case you will have to call the macro „DocumentsCorePackMacro“

    Here is a short example:
    Public Sub DocumentsCorePackMacro()
    MsgBox ("Hello World - DocumentsCorePackMacro")
    End Sub
  • If you press „Create CRM Activity“ in Word and the whole merge process is finished. In this case you will have to call the macro „DocumentsCorePackMacroAfterCreate“. 

    Here is a short example:
    Public Sub DocumentsCorePackMacroAfterCreate()
    MsgBox ("Hello World - DocumentsCorePackMacroAfterCreate")
    End Sub

  • DocumentsCorePackMacroAfterDatasourceLoaded - Will be executed after the datasource of the .dot template was loaded

    Here is a short example:
    Public Sub DocumentsCorePackMacroAfterDatasourceLoaded()
    MsgBox ("Hello World - DocumentsCorePackMacroAfterDatasourceLoaded")
    End Sub

  • DCPMacro - After the .docx file was sucessfully generated.

    Here is a short example:
    Public Sub DCPMacro()
    MsgBox ("Hello World - DCPMacro")
    End Sub

In these two methods you can define your own macros.

6.  Now just press the „Save Template“ button of the WMM/DCP Add-on and the template is ready for use.

Please do not hesitate to contact us via support@mscrm-addons.com should you require further information.

Tags: ,

Tag Cloud

This will be shown to users with no Flash or Javascript.

Page List