locked
Mail merge macro problem: Different behaviour with browser and CRM fo Outlook ?!? RRS feed

  • Question

  • Hello!

    We have a problem with our mail merge templates.

    VBA-Code executes when doing mail merge from web browser but fails with CRM for Outlook. A simple Document_Open() works when doing mail merge from web interface but is is not run from CRM for Outlook. It seems to be that we can't run any kind of code when doing mail merge from CRM for Outlook. A simple example which is run from web browser CRM but not from CRM for Outlook when doing a mail merge:

    Sub Document_Open()
        MsgBox "DOC open"
    End Sub

    All ideas, resolutions and pointer are welcome!

    Regards
    Mika

    Monday, August 30, 2010 3:06 PM

Answers

All replies

  • Have you checked the security of macros in MS Word when you open it from outlook?


    MSCRM Bing'd - http://bingsoft.wordpress.com
    Monday, August 30, 2010 4:38 PM
    Moderator
  • Hi,

     

    This may be, because mail merge is initiated totally differently from a web client and from the Outlook client. The web client opens a Word doc and forces a macro, whilst the Outlook client opens the internal office tools locally. We experienced a similar issue and we discovered that it is because the Outlook client uses some COM objects to communicate to Office.

     

    Kind regards,

    Kuba


    -- Kuba Skałbania, Netwise
    Monday, August 30, 2010 8:41 PM
  • Hi!

    Macro security & other basic issues are covered. It has to do something with how the mail merge is initiated since the temporary documents opened and created before the macro is run are totally different.

    Kuba, were you able to run the macros when doing mail merge from Outlook client?

    With regards
    Mika

    Tuesday, August 31, 2010 5:35 AM
  • Hi Mika,

     

    Your problem definitely stems from the fact that Outlook client does not need macros - here is the description: http://blogs.msdn.com/b/crm/archive/2008/01/15/mscrm-4-0-mail-merge-basics.aspx We did not manage to run macros - we changed the COM in order to replace the builtin functionality. Think twice before doing it and consider why you would like to change macros at all...

     

    I hope that helps,

    Kuba


    -- Kuba Skałbania, Netwise
    Tuesday, August 31, 2010 9:45 AM
  • Hi Mika and Kuba,

    Mika, did you solve this problem?

    I implemented a macro that saves the result of a mail merge to a sharepoint library whos url is included in the data passed from CRM 4. This works fine when initiating the mail merge from explorer but fails when initiated from the Outlook klient.

    I understand that the standard CRM-macro is not needed when initiating mail merge from Outlook but I still want my macro to execute.

    Is there any way I can get the macro to run in this scenario?

    Is there a better way to achieve this automatic saving of the resulting document in the Outlook scenario?

    Is there any way to achieve this that would work in both web and outlook scenarios?

    Regards

    Per
    Friday, June 10, 2011 9:24 AM