Thread: trial period
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
John Coleman John Coleman is offline
external usenet poster
 
Posts: 274
Default trial period

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. If your spreadsheet needs macros to operate then this
wouldn't be an option for the user, but if the only VBA code is to
implement a trial period then it might be a problem.

It is possible to sabotage a spreadsheet so that it stops working
properly in 7 days, even if macros are disabled. The idea is to replace
*each* formula, F, on the spreadsheet by say

=If(Today() < Date(2006,10,17),F,"Please Register").

This can be done in a macro (to be run before distributing the
spreadsheet, and assuming that the sheets are not yet protected):
_____________________________________

Sub TimeTrial()
Dim ws As Worksheet
Dim cl As Range
Dim expDate As Date
Dim expDateString As String

expDate = DateAdd("d", 7, Date)
expDateString = "Date(" & Year(expDate) & "," & Month(expDate) & "," &
_
Day(expDate) & ")"
For Each ws In ActiveWorkbook.Sheets
For Each cl In ws.UsedRange.Cells
If cl.HasFormula = True Then
cl.Formula = "=If(Today()<" & _
expDateString & "," & Mid(cl.Formula, 2) & _
", ""Please Register"")"
End If
Next cl
Next ws

End Sub
__________________________________________________ _________________

After running this sub, password-protect the sheet so that these
formulas are both hidden and protected. Everything will be functionally
identical *until* the 7 days expires - then all of the formulas turn
into an annoying reminder to register.

If you want to go this route, a matching macro would have to be written
to restore the formulas to their original condition. This would be a
somewhat annoying parsing problem and would involve monkeying around
with worksheet protection- so I won't pursue it anymore unless there is
interest.

Just an idea

-John Coleman


Jay wrote:
Hi
I have a workbook , i would like to give a Trial Period of 7 days ,
after that they should register inorder for them to continue using the
work book

can anyone provide macro code to do the same

i have no knowledge on vba coding , if you could explain how to do this
, i m greatful to y9ou

thank you in advance

Regards
Jay