> Overlooked the fact that you can't alter the VBE if the WB is protected,
> so you will have to have a fixed start date of the trial period, added at
> line 5, so you will get:
>
> Sub TestTrial()
> '38778
> With ThisWorkbook.VBProject.VBComponents("Module1").CodeModule
> If CLng(Date) - CLng(Replace(Trim(.Lines(5, 1)), _
> "'", _
> "", _
> 1, _
> 1, _
> vbBinaryCompare)) > 30 Then
> 'more than 30 usage of WB, so out of trial period
> '------------------------------------------------
> bOutTrialPeriod = True
> End If
> End With
>
> End Sub
>
>
> RBS
>
>
> "RB Smissaert" <bartsmissaert[ at ]blueyonder.co.uk> wrote in message
> news:ujwtA6YPGHA.3260[ at ]TK2MSFTNGP11.phx.gbl...
>> Forgot to say run TestTrial from the Workbook_Open event.
>>
>> RBS
>>
>> "RB Smissaert" <bartsmissaert[ at ]blueyonder.co.uk> wrote in message
>> news:eBQYMlYPGHA.428[ at ]tk2msftngp13.phx.gbl...
>>> Or another way, with a password on the VBAProject:
>>>
>>> Option Explicit
>>> Private bOutTrialPeriod As Boolean
>>>
>>> Sub TestTrial()
>>>
>>> With ThisWorkbook.VBProject.VBComponents("Module1").CodeModule
>>> If .Find("'", _
>>> 5, _
>>> 1, _
>>> 5, _
>>> 2, _
>>> False, _
>>> True) = False Then
>>> 'marking the first date the WB was used
>>> '--------------------------------------
>>> .ReplaceLine 5, "'" & CLng(Date)
>>> ThisWorkbook.Save
>>> Else
>>> If CLng(Date) - CLng(Replace(Trim(.Lines(5, 1)), _
>>> "'", _
>>> "", _
>>> 1, _
>>> 1, _
>>> vbBinaryCompare)) > 30 Then
>>> 'more than 30 usage of WB, so out of trial period
>>> '------------------------------------------------
>>> bOutTrialPeriod = True
>>> End If
>>> End If
>>> End With
>>>
>>> End Sub
>>>
>>> The variable bOutTrialPeriod can then be used for whatever way to make
>>> the WB
>>> more or less unusable, ranging from a nagging message to making it
>>> close.
>>> Note that this doesn't need a reference to Microsoft Visual Basic for
>>> Applications Extensibility
>>>
>>>
>>> RBS
>>>
>>>
>>> "Bob Phillips" <bob.phillips[ at ]notheretiscali.co.uk> wrote in message
>>> news:O4Mlg$XPGHA.668[ at ]TK2MSFTNGP11.phx.gbl...
>>>> Philip,
>>>>
>>>> Before you spend your $70, and on the basis of the type of users you
>>>> have,
>>>> try this approach first.
>>>>
>>>> Private Sub Workbook_Open()
>>>> Const sEDName As String = "__ExpiryDate"
>>>> Const nEvalPeriod As Long = 30
>>>> Dim ExpiryDate As Date
>>>> Dim sDate As String
>>>>
>>>> On Error Resume Next
>>>> ExpiryDate = Evaluate(ThisWorkbook.Names(sEDName).RefersTo)
>>>> On Error GoTo 0
>>>>
>>>> If ExpiryDate = 0 Then
>>>> ThisWorkbook.Names.Add Name:=sEDName, _
>>>> RefersTo:=Date + nEvalPeriod
>>>> ThisWorkbook.Names(sEDName).Visible = False
>>>> ThisWorkbook.Save
>>>> Else
>>>> If ExpiryDate < Date Then
>>>> ThisWorkbook.Close savechanges:=False
>>>> End If
>>>> End If
>>>>
>>>> End Sub
>>>>
>>>> 'This is workbook event code.
>>>> 'To input this code, right click on the Excel icon on the worksheet
>>>> '(or next to the File menu if you maximise your workbooks),
>>>> 'select View Code from the menu, and paste the code
>>>>
>>>>
>>>>
>>>> --
>>>> HTH
>>>>
>>>> Bob Phillips
>>>>
>>>> (remove nothere from email address if mailing direct)
>>>>
>>>> "Phil C" <philip.cosgriff[ at ]virgin.net> wrote in message
>>>> news:Onfk2VWPGHA.720[ at ]TK2MSFTNGP14.phx.gbl...
>>>>> Bob .. and RBS
>>>>>
>>>>> Thanks for your responses. The sort of people on the receiving end are
>>>>> not
>>>>> the types with the time or inclination to crack software security
>>>>> systems,
>>>>> however weak. This only needs to be 'token security' to fulfill its
>>>> purpose
>>>>> (i.e. clearly demonstarte that it is not the release version).
>>>>>
>>>>> AppsSentinel sounds like it would do the job (I don't want to invest
>>>>> much
>>>>> time on this, as I may not get many more requests for an evaluation
>>>> copy!),
>>>>> so may invest in the Lite version ($70) to find out..
>>>>>
>>>>> Philip
>>>>>
>>>>>
>>>>> "Bob Phillips" <bob.phillips[ at ]notheretiscali.co.uk> wrote in message
>>>>> news:u#oJpgVPGHA.428[ at ]tk2msftngp13.phx.gbl...
>>>>> > You can do various things, but all of them are pointless if faced by
>>>>> someone
>>>>> > who intends to crack it as Excel security is laughably weak.
>>>>> >
>>>>> > I haven't used it with VBA myself, but the author assures me that
>>>>> >
http://www.thescarms.com/appsentinel/default.asp the functionality
>>>>> > does
>>>>> > extend to VBA, but of course you need to buy it.
>>>>> >
>>>>> > --
>>>>> > HTH
>>>>> >
>>>>> > Bob Phillips
>>>>> >
>>>>> > (remove nothere from email address if mailing direct)
>>>>> >
>>>>> > "Phil C" <philip.cosgriff[ at ]virgin.net> wrote in message
>>>>> > news:%233X7UHVPGHA.3196[ at ]TK2MSFTNGP09.phx.gbl...
>>>>> > > Hi folks
>>>>> > >
>>>>> > > I have produced a complex spreadsheet (medical application) that
>>>>> > > is
>>>> now
>>>>> > > available for sale at a modest price. It contains some VBA, but
>>>>> > > not
>>>>> much.
>>>>> > I
>>>>> > > am not an expert, but have made extensive use of Excel's built-in
>>>>> > functions
>>>>> > > for curve fitting, graph ploting etc. A colleague in another (UK)
>>>>> hospital
>>>>> > > has asked about an 'evaluation version'. Is there a standard way
>>>>> > > of
>>>>> > > producing a spreadsheet that has all the basic functionality to
>>>>> > > allow
>>>> a
>>>>> > user
>>>>> > > to decide whether it works properly etc, but with something key
>>>> missing
>>>>> > > (that would prompt them to buy the full version!)?
>>>>> > >
>>>>> > > Time-out after (say) 30 days. I seem to recall that this is not
>>>>> > > straightforward
>>>>> > > Somehow disable the sheet | print function?
>>>>> > > Any other ideas?
>>>>> > >
>>>>> > > I am using Excel 2003. My development machine still has Windows
>>>>> > > 2000,
>>>>> but
>>>>> > > most potential users will have XP.
>>>>> > >
>>>>> > > Thanks for you help.
>>>>> > >
>>>>> > > Philip
>>>>> > >
>>>>> > >
>>>>> > >
>>>>> > >
>>>>> > >
>>>>> >
>>>>> >
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>