Solved

Set macro security level to 'low level' on opening of a certain workbook.

Posted on 2010-11-09
7
456 Views
Last Modified: 2012-05-10
Dear Experts:

On opening of a certain workbook, I would like to get the macro security level set to 'low level' (enable all macros) automatically (by VBA), regardless of the fact that it may have been set to this low level before.

How is this achieved?

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
0
Comment
Question by:AndreasHermle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 50

Assisted Solution

by:Ingeborg Hawighorst
Ingeborg Hawighorst earned 84 total points
ID: 34097559
Hello Andreas,

by definition, macros can not set the security level of the application. That would defy the purpose of the security level in the first place, since it would be possible to write malicious code that simply sets the security level to low and then proceeds to run the macro.

So, the user needs to manually set the security level, then open the file they want to run.

cheers, teylyn
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 183 total points
ID: 34097574
AndreasHermle,You can't.  Think about it: if you could toggle this programmatically, then there would be no point to even having that setting.You need to either have macro security set to low via Group Policy (bad idea), or look into digitally signing the code.Patrick
0
 
LVL 50

Assisted Solution

by:Dave Brett
Dave Brett earned 150 total points
ID: 34097767
vbscript offers an external workaround that

1) Would set the security to the required level in the registry
2) Then automatically open the file

We can progress this if you wish

Dave
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 92

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 183 total points
ID: 34097832
Dave,I am aware of the Registry hack, but I avoid using it.  Some questions:1) If users are blocked by GPO from editing the Registry, will that block the script?2) Will that script leave Low as the new setting going forward, then (unless there is already some GPO that would reset the setting in the next Windows session or something like that)?Patrick
0
 
LVL 50

Assisted Solution

by:Dave Brett
Dave Brett earned 150 total points
ID: 34097862
Patrick

> 1) If users are blocked by GPO from editing the Registry, will that  block the script?

I think so - I have never been able to test this as I dont have that GPO in place

> 2) Will that script leave Low as the new setting going forward

I would store the current setting then reset it.
or
Run the macros from within the script rather than the workbook - which on second thought would avoid fiddling with the VBA macro settings at all (as long as the GPO allowed scripts)

Cheers

Dave


0
 
LVL 23

Assisted Solution

by:Michael74
Michael74 earned 83 total points
ID: 34098775
You could always place the file in a trusted location
http://technet.microsoft.com/en-us/library/cc261678%28office.12%29.aspx
0
 

Author Comment

by:AndreasHermle
ID: 34119174
Dear all,

thank you very much for your great support. Every comment is useful, therefore I will try and distribute the points equally.

Brettdj: thank you very much for your prepardness to progress the VB script version if I wish. Since this macro would be run in a company environment I would have to involve other guys to allow Registry editing. Actually, I do not want that. So, I guess, I will rather look into digitally sign the code.

Thank you again for your great support.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question