Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
file access & options settings | Excel Discussion (Misc queries) | |||
Weekly Transaction Processing | Excel Worksheet Functions | |||
Macros disappear after a file is imported | Excel Discussion (Misc queries) | |||
File is locked for Editing by user problem | Excel Discussion (Misc queries) | |||
Network access to file - read only property | Excel Discussion (Misc queries) |