Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Return Excel's current security setting
Using Office 2003 and Windows XP;
Is there a way, using VBA, to return Excel's CURRENT macro security level? I'm referring to the settings, Low, Medium, High and Very High. Please note, I just want to get it, NOT change it. I understand that it would only run if macros are already enabled. Could someone please post example code? Thanks much in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Return Excel's current security setting
From Bob Phillips:
Sub dural() Dim oWSH As Object Dim sResult Set oWSH = CreateObject("WScript.Shell") On Error Resume Next sResult = oWSH.RegRead("HKCU\Software\Microsoft\Office\11.0\ Excel\Security\Level") On Error GoTo 0 If Err.Number < 0 Or sResult = "" Then MsgBox "Read key error" Else MsgBox sResult End If Err.Clear End Sub The 11.0 may be to be 10.0 or 12.0 -- Gary''s Student - gsnu200734 "XP" wrote: Using Office 2003 and Windows XP; Is there a way, using VBA, to return Excel's CURRENT macro security level? I'm referring to the settings, Low, Medium, High and Very High. Please note, I just want to get it, NOT change it. I understand that it would only run if macros are already enabled. Could someone please post example code? Thanks much in advance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Return Excel's current security setting
Thanks GS, this is what I was looking for...
Also, do you happen to know, isn't there another method in which the registry is not involved? Bob's method works great - but I'm thinking that conventional VBA may traverse XL versions more seamlessly? (i.e. no checking 10.0; 11.0; 12.0) "Gary''s Student" wrote: From Bob Phillips: Sub dural() Dim oWSH As Object Dim sResult Set oWSH = CreateObject("WScript.Shell") On Error Resume Next sResult = oWSH.RegRead("HKCU\Software\Microsoft\Office\11.0\ Excel\Security\Level") On Error GoTo 0 If Err.Number < 0 Or sResult = "" Then MsgBox "Read key error" Else MsgBox sResult End If Err.Clear End Sub The 11.0 may be to be 10.0 or 12.0 -- Gary''s Student - gsnu200734 "XP" wrote: Using Office 2003 and Windows XP; Is there a way, using VBA, to return Excel's CURRENT macro security level? I'm referring to the settings, Low, Medium, High and Very High. Please note, I just want to get it, NOT change it. I understand that it would only run if macros are already enabled. Could someone please post example code? Thanks much in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Security Setting | Excel Discussion (Misc queries) | |||
Security - Setting | Excel Programming | |||
Security setting on Low, but Macro will not run? | Excel Programming | |||
Override excel's printing dpi setting | Excel Programming | |||
Error Setting Excel's Application.Left Property | Excel Programming |