Thread: trial period
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
moon[_7_] moon[_7_] is offline
external usenet poster
 
Posts: 53
Default trial period


Cool piece of text, the VBS is quite okay.
But indeed, how far can one go? Even distributing a (read only) file on
CD-Rom won't work because we both know that just everything is hackable; if
you secured a workbook the ultimate way, then there's always a hex-editor
which is so generous to show us the project password in plain text.
Do you remember you ever failed when trying to crack a 'protected' workbook?
I guess not.
So help from an external application (like a dll) is definitely required
when it comes on protecting MS Office user files.

Hans




"John Coleman" schreef in bericht
oups.com...

moon wrote:
"John Coleman" schreef in bericht
oups.com...
Greetings,

A VBA approach such as Moon's will definitely work but has the
potential drawback that it might be circumventable by the expedient of
disabling macros.



Be inventive, let the workbook come up with an empty sheet by default and
show the real stuff if macro's is enabled.


Pretty good idea. At first I thought that you could defeat it by
disabling macros *after* the workbook is open (so that the before_close
or auto_close macros which presumably rehide the sheets wouldn't fire)
but discovered that disabling macros while a workbook is open only
takes effect after the workbook is closed. Then I thought of typing
"Application.EnableEvents = False" in the immediate window. That *will*
disable the before_close event but not the auto_close macro. Finally, I
wrote a script:

'MakeVisible.vbs

Option Explicit

Dim xlApp, wb, ws

Set xlApp = CreateObject("Excel.Application")
xlApp.EnableEvents = False
Set wb = xlapp.Workbooks.Open("trial.xls")

For Each ws in wb.Worksheets
ws.Visible = -1 'xlSheetVisible
Next
wb.Save
wb.Close
Set wb = Nothing
Set xlapp = Nothing

This seems to make all sheets visible without running any macros, but
maybe I'm missing something.

A non-programmer wouln't have the requisite know-how, but it caught my
interest when in your earlier post (which, by the way, contained some
nice code) you warned about sophisticated users who might know how to
edit registry keys. I wondered how such users could thwart the VBA and
how the VBA programmer could in turn thwart them.

An idea I had in an earlier thread (concerning copy-protection) is to
make VBA functionally essential (if it isn't already) by replacing
spreadsheet formulas by user-defined functions which duplicate their
functionality. In many cases this could be achieved by dummy functions
which call the corresponding Application.WorksheetFunction or use
Evaluate on the string representing the original function (with
appropriate substitutions). This would entail some programming overhead
- but you only have to do it on a handful of crucial formulas to
disable the spreadsheet (there better be some pretty special formulas
to justify charging money for the file). The user-defined functions
might entail some overhead, so the macro to be run upon registration
could replace them by the corresponding worksheet functions.

It all depends on how paranoid you want (or need) to be.

-John Coleman