View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
semiopen semiopen is offline
external usenet poster
 
Posts: 25
Default Excel file security

I think that the original poster had the idea of setting security to
low when he is physicaly sitting at their computer "installing" the
file (reading that disk ID number). This would work for a client who is
*extremely* naive - but would be quite unethical (especially when done
to inexperienced users who would need the security umbrella the most).
It is possible to be a little more devious and a little more ethical at
the same time:
1) Get the client to set their security setting to medium - and tell
them to enable the macros whenever they open the file

2) Add some macros that are *essential* to the functioning of the
workbook - and not just essential to the non-copy ploy. This could be
achieved by doing nothing in a clever way - replacing some crucial
worksheet functions by dummy user-defined functions which do nothing
more than pass their parameters to the appropriate.
Application.WorksheetFunction. You can even give these functions
impressive sounding names if you want to throw a little bit of
marketing into the mix.

3) Password-protect the code so they can't tell what the macros are
*really* up to.

I still have some ethical qualms about that - but it would be a heck of
a lot nicer than turning off security altogether on the unsuspecting.

-semiopen

Tom Ogilvy wrote:
for the Original Poster:

And I did try your code and it worked well until I disabled macros. then it
opened and I was free to do whatever I wanted.

Also, many places just set the security to High. In that case, not only
won't the realize you have such a macro in your workbook, it won't even run,
since macros are silently disabled for uncertified macros.

so they will freely share with their friends and never even know that the
workbook shouldn't open.

And as semiopen said, Security is set at the application level and stored
in the registry - not in the workbook. Code in a workbook can not change the
security setting when it is opening.

Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
If DiskVolumeId("C:") < "E06F-9984" Then
msgbox "a serious error has occured. Call Berj at 555-5555 for
help"
Wb.Close savechanges:=False
End If
End Sub

--
Regards,
Tom Ogilvy



"semiopen" wrote:


Berj wrote:
Dear Mr. Tom,

This is my second message to you.
I just realized what you meant by "disabling macros".
I am going to put the file in "low security", so it will just open the file
or not open the file.
As I told you before, the place I live, nobody knows of these things.

Best Regards,
Berj


But - security settings don't reside in the file - they reside in the
application and are not low by default.

-semiopen