A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Microsoft Office Word Forum - WordBanter forum » About WordBanter » About this forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Office Macro security

Thread Tools Display Modes
Old June 21st 12, 11:33 AM
dagarve dagarve is offline
Junior Member
First recorded activity by WordBanter: Jun 2012
Posts: 1
Default Office Macro security

I have a question regarding Macro security handling in Office (specifically in Word and Excel). We are writing Office add-ins that interacts with a Document Management System (DMS). I need to be able to predict whether Word (or Excel) is going to ask the user if wants to enable Macros. Sorry for the long post, but it takes a few lines to explain this. :-)

We have used the DocumentBeforeClose (for Word: Microsoft.Office.Interop.Word.ApplicationEvents4) event where we have written an event handler. Now, every time a user closes a document, given the document has been checked out from the DMS, we ask the user if he wants to check the document in again. This works perfect for most situations, except the following:

• IF the document contains macros AND the macro settings is set to “Disable all macros with notification” (Trust Senter | Macro settings) AND the document is not located in a “Trusted location”, THEN Word will ask the user if he wants to enable macros. If the user ignores this question and continues working with the document, this is still not a problem. However, if the user choses to “Enable macros”, Word closes the document and reopens it (executing macros if applicable).

This also fires the DocumentBeforeClose event, which eventually leads to displaying our question “The document is checked out to you, do you want to check in again?” which is of course inappropriate and not very elegant at this point, because the user is actually opening a document, not closing.

This is the reason why we need to be able to predict WHY Word is closing the document, is it because the user closed the document or is it because Word forced a document close to reopen it with macros enabled. So, if there is a way to predict whether the document is closed for immediate reopening (which is the case if the user confirm that he want to enable macros), we could omit our re-check-in question.

I’ve been looking into using the msoAtuomationSecurity enumerable, but it seems this is set to msoAutomationSecurityLow despite of the security settings in Word which is set to “Disable all macros with notification”.

I have not been able to actually see the connection between the Macro Setting in Word and the value of msoAtuomationSecurity. An alternative solution to the problem could be to detect the Macro Setting in the Trust Center (if possible) and from that decide what to do. But I have not found any way of detecting these settings. Are they stored in registry?

Anyone got a clue?

Thank's in advance

Last edited by dagarve : June 21st 12 at 11:36 AM.

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word Macro Security Bob_McK Microsoft Word Help 2 May 2nd 07 10:26 PM
About Macro Security Parag Vidhate Microsoft Word Help 10 June 23rd 06 01:04 PM
Macro Security ? GaijinSue Microsoft Word Help 2 March 7th 06 06:10 PM
Macro Security Dan Mailmerge 5 January 5th 06 10:37 AM
Macro Security JD Microsoft Word Help 11 April 24th 05 03:02 PM

All times are GMT +1. The time now is 01:48 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2004-2019 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.