Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
 
Posts: n/a
Default Deny file access if user declines macros?

I periodically issue a file that contains macros to users. For ease of
functionality, the users should accept the macros (as when their
security level is set to medium).

Is it possible to deny a user access to the file if he answers "no, do
not allow macros" to the security question?

Thanks

  #2   Report Post  
Gregg Riemer
 
Posts: n/a
Default

Before closing the workbook, you can set the visible property of all the
worksheets to very hidden and then protect the workbook with a password.

Then have an auto exec macro that makes all the sheets visible when the
workbook is opened. The auto exec macro won't execute unless the user
enables macros and they won't know the password to unprotect the workbook.

Try something along the lines of the following:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheets("Sheet1").Visible = False
Sheets("Sheet1").Visible = xlVeryHidden
ActiveWorkbook.Protect Password:="enter a password here"
End Sub

Private Sub Workbook_Open()
ActiveWorkbook.Unprotect Password:="enter a password here"
Sheets("Sheet1").Visible = True
End Sub

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheets("Sheet1").Visible = False
Sheets("Sheet1").Visible = xlVeryHidden
ActiveWorkbook.Protect Password:="susan"
End Sub


" wrote:

I periodically issue a file that contains macros to users. For ease of
functionality, the users should accept the macros (as when their
security level is set to medium).

Is it possible to deny a user access to the file if he answers "no, do
not allow macros" to the security question?

Thanks


  #3   Report Post  
JE McGimpsey
 
Posts: n/a
Default

This will work fine for the incurious user. Just be aware that anyone
with enough gumption to find these newsgroups can find ways to bypass
that level of protection.

In article ,
Gregg Riemer wrote:

Before closing the workbook, you can set the visible property of all the
worksheets to very hidden and then protect the workbook with a password.

Then have an auto exec macro that makes all the sheets visible when the
workbook is opened. The auto exec macro won't execute unless the user
enables macros and they won't know the password to unprotect the workbook.

  #4   Report Post  
 
Posts: n/a
Default

Thanks, Gregg and JE. As I thought about it over the weekend the
solution I came up with was to set a boolean value to FALSE on file
exit, and use a startup macro to set that value to TRUE when they
accepted macros. Then tag certain critical formulas to operate only
when that value is TRUE. But I like the xlVeryHidden idea- thanks.

Is there- or did there use to be- a function called xlHopelesslyHidden?
This is ringing a bell for some reason.

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
file access & options settings benb Excel Discussion (Misc queries) 1 February 4th 05 02:36 AM
Weekly Transaction Processing Ralph Howarth Excel Worksheet Functions 4 January 19th 05 06:37 AM
Macros disappear after a file is imported Brent E Excel Discussion (Misc queries) 1 December 18th 04 01:25 AM
File is locked for Editing by user problem Mirth Excel Discussion (Misc queries) 1 December 3rd 04 05:45 PM
Network access to file - read only property AL Excel Discussion (Misc queries) 1 December 2nd 04 02:22 AM


All times are GMT +1. The time now is 04:08 AM.

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

About Us

"It's about Microsoft Excel"