• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 469
  • Last Modified:

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

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
AndreasHermle
Asked:
AndreasHermle
6 Solutions
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
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
 
Patrick MatthewsCommented:
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
 
Dave BrettCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Patrick MatthewsCommented:
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
 
Dave BrettCommented:
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
 
Michael FowlerSolutions ConsultantCommented:
You could always place the file in a trusted location
http://technet.microsoft.com/en-us/library/cc261678%28office.12%29.aspx
0
 
AndreasHermleAuthor Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now