View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default 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.