Solved

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

Posted on 2010-11-09
7
424 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
7 Comments
 
LVL 50

Assisted Solution

by:teylyn
teylyn 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now