Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Security Setting Tarig Excel Discussion (Misc queries) 1 January 6th 08 12:22 PM
Security - Setting Ardy Excel Programming 10 June 29th 07 02:28 PM
Security setting on Low, but Macro will not run? Ouka[_20_] Excel Programming 6 September 8th 05 01:26 AM
Override excel's printing dpi setting [email protected] Excel Programming 0 June 29th 05 11:07 AM
Error Setting Excel's Application.Left Property James Cox[_2_] Excel Programming 0 December 9th 04 09:13 PM


All times are GMT +1. The time now is 02:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"