none
Security Warning Bar disappearing after a second RRS feed

  • Question

  • I have a word 2007 template which has a macro in it.  I have my trust settings to disable macros with notification.  When I open a document with macros the security warning message bar is visible one second and it disappear.  I do not get a chance to enable it from the bar before it disappears.  I do not want to enable all macros and I would like the option to enable it from the bar.

    I tried to find answers to this but I found one where it just said it is a known microsoft bug.  Also I got one reply that this is possibly by design.

    I guess I don't understand how this is by design.  What is the difference between disable macros with notification and disable macros without notification?  Ultimately they are both the same since you don't get a chance to enable from the security warning bar.  I know in word 2003 you get the pop up where you can say enable.  Also in word 2007 I know I have seen where the bar stays and you do have a chance to click the options button to then enable it.

    If I open the template manually the bar does not disappear.  It is only when the template is opened as part of the runtime process of our application.  It makes me wonder if it is some other setting on the machine that is automatically overriding the notification?

    Any information would be much appreciated!

    Thanks!

    Tuesday, June 28, 2011 3:41 PM

Answers

  • Hi Sara

    <<So I would say that it is not getting automatically trusted but rather automatically disabling it.>>

    Ok, that definitely makes more sense to me. Thanks for the code sample - this is really old stuff! Originally Word 6.0/95 (early to mid-1990s) WordBasic that was brought forward to VBA in Word 97. At some point, this is going to break :-) Backwards compatibility is all fine and good, but at some point the application will develop beyond that. Luckily for you mail merge is one of the few things MS doesn't seem interested in changing...

    <<The second thing you mention Application.AutomationSecurity is definitely not used in the macro vba code. >>

    OK, let's try putting that in. This was introduced in Word 2003 to let macros explicitly open documents with/without macros enabled - it overrides the setting you're talking about for the documents the code opens. Stick the following line of code in before the WordBasic.FilelOpen line in the macro you show us:

    AutomationSecurity = msoAutomationSecurityForceDisable

    As soon as the macro finishes, the macro security setting will behave as you've set it in the UI - no need to worry about it being permanently disabled due to this line of code.


    Cindy Meister, VSTO/Word MVP
    Wednesday, June 29, 2011 9:07 AM
    Moderator

All replies

  • Hi Sara

    <<It is only when the template is opened as part of the runtime process of our application. >>

    What kind of application is this? I can think of two logical things

    1. Since your application is trusted, any kind of file it opens is automatically trusted. That's why I ask what kind of application this is, as that could have a bearing.

    2. Your application is setting Application.AutomationSecurity, which would definitely override any Trust Center settings.


    Cindy Meister, VSTO/Word MVP
    Tuesday, June 28, 2011 4:25 PM
    Moderator
  • We have a custom application which creates a data source for the templates and creates a word document with the fields to pass into the templates we have.  The application determines the template to open depending on which window is processing.  Right now it is definitely not working when set to disable with notifications because something is automatically disabling without the user getting the chance to click on the Options button.  So I would say that it is not getting automatically trusted but rather automatically disabling it.

    The second thing you mention Application.AutomationSecurity is definitely not used in the macro vba code.  The macro code is as follows:

    Public Sub PerformMerge()
    Dim firstwin$
    WordBasic.AppMinimize "Microsoft Word", 1
    If WordBasic.[Files$]("c:\temp\cucc009.doc") <> "" Then
    firstwin$ = WordBasic.[WindowName$]()
    WordBasic.FileOpen "C:\temp\cucc009.doc"
    WordBasic.FileClose 2
    WordBasic.MailMerge CheckErrors:=1, Destination:=0, MergeRecords:=0, From:="", To:="", Suppression:=0, MailMerge:=1, MailSubject:="", MailAsAttachment:=0, MailAddress:=""
    WordBasic.Activate firstwin$
    WordBasic.FileClose 2
    End If
    WordBasic.AppRestore
    End Sub
    

     

     

    Tuesday, June 28, 2011 6:09 PM
  • Hi Sara

    <<So I would say that it is not getting automatically trusted but rather automatically disabling it.>>

    Ok, that definitely makes more sense to me. Thanks for the code sample - this is really old stuff! Originally Word 6.0/95 (early to mid-1990s) WordBasic that was brought forward to VBA in Word 97. At some point, this is going to break :-) Backwards compatibility is all fine and good, but at some point the application will develop beyond that. Luckily for you mail merge is one of the few things MS doesn't seem interested in changing...

    <<The second thing you mention Application.AutomationSecurity is definitely not used in the macro vba code. >>

    OK, let's try putting that in. This was introduced in Word 2003 to let macros explicitly open documents with/without macros enabled - it overrides the setting you're talking about for the documents the code opens. Stick the following line of code in before the WordBasic.FilelOpen line in the macro you show us:

    AutomationSecurity = msoAutomationSecurityForceDisable

    As soon as the macro finishes, the macro security setting will behave as you've set it in the UI - no need to worry about it being permanently disabled due to this line of code.


    Cindy Meister, VSTO/Word MVP
    Wednesday, June 29, 2011 9:07 AM
    Moderator
  • Thank you Cindy!  I understand that what you explain is a solution to this but it still doesn't explain the behavior.  Unfortunately at this time our project is not able to make changes to any code as the phase of the project we are in.  For now we will have to just enable all macros so that we can get the mail merge letters to work.  I will take note of this for the future for when they do have time to make changes to the templates.

    Thank you very much for your help!

    Sara

    Wednesday, July 6, 2011 1:16 PM