true but your statment is a little obvious who ever said excell or any other
computer program was fool proof , the simple fact of the matter is most pc
users ony know how to do what they are shown to do on a computer and TMACK
will know his users abilitys better than you or i,
Actually JE's post is spot on.
This ain't 1985 any more. Users *aren't* awed by the mystical beige
box which runs unfathomable programs. They tend to read about how to
use their applications better. They learn things from other users.
They are NOT dependent on the office guru to teach them how to do
everything, and they're often prepared to learn things on their own,
those rascals. The first one to learn how to use Google (and I think
that applies to not less than 90% of the users who can find the "On"
button) and figure out how to type in "Crack Excel Password" will be
rewarded with whatever secrets tmack wants to keep.
You don't need to know any advanced coding to do this. You can copy
and paste from any number of postings which contain the relevant code.
The users don't know how to create a VBA macro? Fine, but I'll bet
they know how to use a menu item. Rob Bovey's Excel Utilities add-in,
which is freely downloadable, has "Break Passwords" right there on the
menu bar.
We're not talking about something that's merely "not foolproof". We're
talking about a joke of a "security" restriction which yields as
easily as a peanut does to a sledgehammer.
Speaking of which... I don't think that your code is such a good idea
either.
Sheets("viewer 1").Visible = False
will indeed hide the sheet, but the user can make ALL of the sheets
visible again by going to Format -> Sheet -> Unhide. Each and every
hidden sheet will be only a click or two away.
(This of course presupposes that the user doesn't disable the macros
before opening the workbook. If you rely on the Aut
pen() macro to
HIDE the sheets (and bear in mind that your code will error out unless
there's at least ONE sheet still visible), then all they need to do is
disable the macros and everything will open unhidden. You would need
to reverse the process to have any kind of security at all; that is,
hide all of the sheets with data before you save it (leaving only a
"cover sheet" visible), then have the Aut
pen() macro or the
Workbook_Open event UNHIDE the relevant sheet. You'd then need to have
the Workbook_BeforeClose event RE-HIDE that sheet AND re-save the
workbook. And even that can be gotten around if one is sufficiently
devious.)
You can get a LITTLE more security by having the sheets' visible
property set to xlSheetVeryHidden instead of False, since that will at
least prevent them from appearing in the Format -> Sheet -> Unhide
menu item. The VBA project would also need to be protected to ensure
that the user couldn't make them visible through there. But again, as
JE rightly states, this is not exceptionally strong security. It will
prevent casual hacking, but that's about it.
A secured Access database provides more security, but again I wouldn't
trust it with anything that was seriously confidential. Let's put it
this way; if someone has access to a data file, then they can crack
it. Period. Going the route of having separate workbooks with separate
opening passwords (preferably with each user's file stored on a
network drive that only they and you have access to) is about as
secure as you can get, which is to say, not exceptionally. If it's
something that really, REALLY needs security, and I'm thinking here of
employee pay records and the like, the only real way to do it is to
bite the bullet and go the whole hog (pardon the mixed metaphore) with
something like an SQL*Server client / server setup. That is, where the
data files are hidden away from the users, and only the relevant
chunks of data get fed to the client.
Whether this is worth the time and expense in any particular case is
left as an exercise for the individual user.