none
The macro execution is stopped after the user click " Enable this content" ? RRS feed

  • Question

  • I use this command line 

    "WINWORD.EXE /l d:\compare.dotm /mCompareDocument"

    After the word is open, there is a bar on top of WORD say " The macro is disabled", when the user click "Enable content", The macro "CompareDocument" does not continue execute.  How can I change this? 

    Monday, June 30, 2014 8:54 AM

Answers

  • Which version of Word are we discussing?

    It appears that macro security is enabled. If you need to avoid it, and this is Word 2007 or later, then you need to ensure that either

    1. The macro is digitally signed (in the VBA Editor, under the Tools menu) and that the user's machine is set up to trust that signature OR

    2. The macro is saved to a "Trusted" location OR

    3. Word is configured to let all macros run (not recommended)


    Cindy Meister, VSTO/Word MVP, my blog

    Monday, June 30, 2014 3:07 PM
    Moderator
  • This is security behavior in Word 2013: documents that are not trusted are "sand-boxed". I outlined three possible approaches (also applicable in 2007 and 2010) that can be used to avoid this problem in my previous reply.

    Microsoft made the - somewhat difficult - decision to leave trust questions up to the user (or IT), rather than just take macro support out of the product completely. You may think the behavior is confusing to the user, but it is by design and is the user's responsibility. Options are provided that will make life easier for the developer and the user, but the developer must be prepared to take some responsibility, as well (digital signature, for example).


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, July 2, 2014 12:30 PM
    Moderator

All replies

  • Which version of Word are we discussing?

    It appears that macro security is enabled. If you need to avoid it, and this is Word 2007 or later, then you need to ensure that either

    1. The macro is digitally signed (in the VBA Editor, under the Tools menu) and that the user's machine is set up to trust that signature OR

    2. The macro is saved to a "Trusted" location OR

    3. Word is configured to let all macros run (not recommended)


    Cindy Meister, VSTO/Word MVP, my blog

    Monday, June 30, 2014 3:07 PM
    Moderator
  • Which version of Word are we discussing?

    It appears that macro security is enabled. If you need to avoid it, and this is Word 2007 or later, then you need to ensure that either

    1. The macro is digitally signed (in the VBA Editor, under the Tools menu) and that the user's machine is set up to trust that signature OR

    2. The macro is saved to a "Trusted" location OR

    3. Word is configured to let all macros run (not recommended)


    Cindy Meister, VSTO/Word MVP, 

    I am using word2013, I found its behaviors is different from the word2007.

    In word 2013.
    When I Run

    "WINWORD.EXE /l d:\compare.dotm /mCompareDocument"

    1) the word is opened

    2) a bar below the toolbar show "The macro is diabled" with a button " Enable this content"

    3) when I click the button "Enable this content" the macro "CompareDocument"  is not executed. I think the button should do two things (*) Marked this macro as trusted. (**) Execute the macro "CompareDocument" which is disabled.

    It seems in step 3.  Only (*) is done by WORD, (**) is not done. I think it is a bit confused for the user.
    Wednesday, July 2, 2014 3:35 AM
  • This is security behavior in Word 2013: documents that are not trusted are "sand-boxed". I outlined three possible approaches (also applicable in 2007 and 2010) that can be used to avoid this problem in my previous reply.

    Microsoft made the - somewhat difficult - decision to leave trust questions up to the user (or IT), rather than just take macro support out of the product completely. You may think the behavior is confusing to the user, but it is by design and is the user's responsibility. Options are provided that will make life easier for the developer and the user, but the developer must be prepared to take some responsibility, as well (digital signature, for example).


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, July 2, 2014 12:30 PM
    Moderator