Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Code for "program evaluation period"?

Hi Guys

Could someone please tell me what is wrong with the following (placed in
ThisWorkbook)?
I got the basic code from Bob Phillips via this NG, which worked fine. It
just stopped (closed imediately) after x days (with no message to user)
All I have done is to set the trial.period to 1 day (for test purposes) and
added a few lines of message text using Msg.
Now the excel spreadsheet in question (Excel 2000) runs on beyond the trial
period...
I have also tried reducing the message box to 1 line (and other irrational
things) but can no longer persude it to close!
Any ideas?

Thanks for your help

Phil

***************

Private Sub Workbook_Open()
Const sEDName As String = "__ExpiryDate"
Const nEvalPeriod As Long = 1
Dim ExpiryDate As Date
Dim sDate As String
Dim Msg 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
Msg = "The trial period has been exceeded." & vbCrLf
Msg = Msg & "If you wish to continue using, purchase the
program via the website:" & vbCrLf
Msg = Msg & "website.com" & vbCrLf
MsgBox Msg
ThisWorkbook.Close savechanges:=False
End If
End If

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Code for "program evaluation period"?

Phil,

It actually allows 2 days because you are testing ExpiryDate < Date. Have
you just not waited long enough?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Phil C" wrote in message
...
Hi Guys

Could someone please tell me what is wrong with the following (placed in
ThisWorkbook)?
I got the basic code from Bob Phillips via this NG, which worked fine. It
just stopped (closed imediately) after x days (with no message to user)
All I have done is to set the trial.period to 1 day (for test purposes)

and
added a few lines of message text using Msg.
Now the excel spreadsheet in question (Excel 2000) runs on beyond the

trial
period...
I have also tried reducing the message box to 1 line (and other irrational
things) but can no longer persude it to close!
Any ideas?

Thanks for your help

Phil

***************

Private Sub Workbook_Open()
Const sEDName As String = "__ExpiryDate"
Const nEvalPeriod As Long = 1
Dim ExpiryDate As Date
Dim sDate As String
Dim Msg 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
Msg = "The trial period has been exceeded." & vbCrLf
Msg = Msg & "If you wish to continue using, purchase the
program via the website:" & vbCrLf
Msg = Msg & "website.com" & vbCrLf
MsgBox Msg
ThisWorkbook.Close savechanges:=False
End If
End If

End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Code for "program evaluation period"?

Hi Bob

Yes, I created an "evaluation period = 1 day" version last Friday (4 days
ago) and it still runs..

Phil



"Bob Phillips" wrote in message
...
Phil,

It actually allows 2 days because you are testing ExpiryDate < Date. Have
you just not waited long enough?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Phil C" wrote in message
...
Hi Guys

Could someone please tell me what is wrong with the following (placed in
ThisWorkbook)?
I got the basic code from Bob Phillips via this NG, which worked fine.

It
just stopped (closed imediately) after x days (with no message to user)
All I have done is to set the trial.period to 1 day (for test purposes)

and
added a few lines of message text using Msg.
Now the excel spreadsheet in question (Excel 2000) runs on beyond the

trial
period...
I have also tried reducing the message box to 1 line (and other

irrational
things) but can no longer persude it to close!
Any ideas?

Thanks for your help

Phil

***************

Private Sub Workbook_Open()
Const sEDName As String = "__ExpiryDate"
Const nEvalPeriod As Long = 1
Dim ExpiryDate As Date
Dim sDate As String
Dim Msg 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
Msg = "The trial period has been exceeded." & vbCrLf
Msg = Msg & "If you wish to continue using, purchase the
program via the website:" & vbCrLf
Msg = Msg & "website.com" & vbCrLf
MsgBox Msg
ThisWorkbook.Close savechanges:=False
End If
End If

End Sub






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Code for "program evaluation period"?

Phil,

I will create a workbook now with that code and see what happens tomorrow,
then on Thu. Check back on Thu for a follow-up post by me.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Phil C" wrote in message
...
Hi Bob

Yes, I created an "evaluation period = 1 day" version last Friday (4 days
ago) and it still runs..

Phil



"Bob Phillips" wrote in message
...
Phil,

It actually allows 2 days because you are testing ExpiryDate < Date.

Have
you just not waited long enough?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Phil C" wrote in message
...
Hi Guys

Could someone please tell me what is wrong with the following (placed

in
ThisWorkbook)?
I got the basic code from Bob Phillips via this NG, which worked fine.

It
just stopped (closed imediately) after x days (with no message to

user)
All I have done is to set the trial.period to 1 day (for test

purposes)
and
added a few lines of message text using Msg.
Now the excel spreadsheet in question (Excel 2000) runs on beyond the

trial
period...
I have also tried reducing the message box to 1 line (and other

irrational
things) but can no longer persude it to close!
Any ideas?

Thanks for your help

Phil

***************

Private Sub Workbook_Open()
Const sEDName As String = "__ExpiryDate"
Const nEvalPeriod As Long = 1
Dim ExpiryDate As Date
Dim sDate As String
Dim Msg 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
Msg = "The trial period has been exceeded." & vbCrLf
Msg = Msg & "If you wish to continue using, purchase

the
program via the website:" & vbCrLf
Msg = Msg & "website.com" & vbCrLf
MsgBox Msg
ThisWorkbook.Close savechanges:=False
End If
End If

End Sub








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Code for "program evaluation period"?

Thanks Bob, you're a star.

Phil


"Bob Phillips" wrote in message
...
Phil,

I will create a workbook now with that code and see what happens tomorrow,
then on Thu. Check back on Thu for a follow-up post by me.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Phil C" wrote in message
...
Hi Bob

Yes, I created an "evaluation period = 1 day" version last Friday (4

days
ago) and it still runs..

Phil



"Bob Phillips" wrote in message
...
Phil,

It actually allows 2 days because you are testing ExpiryDate < Date.

Have
you just not waited long enough?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Phil C" wrote in message
...
Hi Guys

Could someone please tell me what is wrong with the following

(placed
in
ThisWorkbook)?
I got the basic code from Bob Phillips via this NG, which worked

fine.
It
just stopped (closed imediately) after x days (with no message to

user)
All I have done is to set the trial.period to 1 day (for test

purposes)
and
added a few lines of message text using Msg.
Now the excel spreadsheet in question (Excel 2000) runs on beyond

the
trial
period...
I have also tried reducing the message box to 1 line (and other

irrational
things) but can no longer persude it to close!
Any ideas?

Thanks for your help

Phil

***************

Private Sub Workbook_Open()
Const sEDName As String = "__ExpiryDate"
Const nEvalPeriod As Long = 1
Dim ExpiryDate As Date
Dim sDate As String
Dim Msg 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
Msg = "The trial period has been exceeded." & vbCrLf
Msg = Msg & "If you wish to continue using, purchase

the
program via the website:" & vbCrLf
Msg = Msg & "website.com" & vbCrLf
MsgBox Msg
ThisWorkbook.Close savechanges:=False
End If
End If

End Sub












  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Code for "program evaluation period"?

As another thing, type this in the VBA immediate window when that file is
open, and see what you get

?Evaluate(ThisWorkbook.Names("__ExpiryDate").Refer sTo)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Phil C" wrote in message
...
Hi Bob

Yes, I created an "evaluation period = 1 day" version last Friday (4 days
ago) and it still runs..

Phil



"Bob Phillips" wrote in message
...
Phil,

It actually allows 2 days because you are testing ExpiryDate < Date.

Have
you just not waited long enough?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Phil C" wrote in message
...
Hi Guys

Could someone please tell me what is wrong with the following (placed

in
ThisWorkbook)?
I got the basic code from Bob Phillips via this NG, which worked fine.

It
just stopped (closed imediately) after x days (with no message to

user)
All I have done is to set the trial.period to 1 day (for test

purposes)
and
added a few lines of message text using Msg.
Now the excel spreadsheet in question (Excel 2000) runs on beyond the

trial
period...
I have also tried reducing the message box to 1 line (and other

irrational
things) but can no longer persude it to close!
Any ideas?

Thanks for your help

Phil

***************

Private Sub Workbook_Open()
Const sEDName As String = "__ExpiryDate"
Const nEvalPeriod As Long = 1
Dim ExpiryDate As Date
Dim sDate As String
Dim Msg 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
Msg = "The trial period has been exceeded." & vbCrLf
Msg = Msg & "If you wish to continue using, purchase

the
program via the website:" & vbCrLf
Msg = Msg & "website.com" & vbCrLf
MsgBox Msg
ThisWorkbook.Close savechanges:=False
End If
End If

End Sub








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Code for "program evaluation period"?

Answer = 39100 ..if that makes any sense..

Phil


"Bob Phillips" wrote in message
...
As another thing, type this in the VBA immediate window when that file is
open, and see what you get

?Evaluate(ThisWorkbook.Names("__ExpiryDate").Refer sTo)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Phil C" wrote in message
...
Hi Bob

Yes, I created an "evaluation period = 1 day" version last Friday (4

days
ago) and it still runs..

Phil



"Bob Phillips" wrote in message
...
Phil,

It actually allows 2 days because you are testing ExpiryDate < Date.

Have
you just not waited long enough?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Phil C" wrote in message
...
Hi Guys

Could someone please tell me what is wrong with the following

(placed
in
ThisWorkbook)?
I got the basic code from Bob Phillips via this NG, which worked

fine.
It
just stopped (closed imediately) after x days (with no message to

user)
All I have done is to set the trial.period to 1 day (for test

purposes)
and
added a few lines of message text using Msg.
Now the excel spreadsheet in question (Excel 2000) runs on beyond

the
trial
period...
I have also tried reducing the message box to 1 line (and other

irrational
things) but can no longer persude it to close!
Any ideas?

Thanks for your help

Phil

***************

Private Sub Workbook_Open()
Const sEDName As String = "__ExpiryDate"
Const nEvalPeriod As Long = 1
Dim ExpiryDate As Date
Dim sDate As String
Dim Msg 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
Msg = "The trial period has been exceeded." & vbCrLf
Msg = Msg & "If you wish to continue using, purchase

the
program via the website:" & vbCrLf
Msg = Msg & "website.com" & vbCrLf
MsgBox Msg
ThisWorkbook.Close savechanges:=False
End If
End If

End Sub










  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Code for "program evaluation period"?

Therein lies the problem Phil. 39100 is 18th Jan 2007, so it won't expire
for another 8 months. How did it get to that value?

I suggest typing this in the immediate window, and starting again, save the
workbook, re-open it, and check Friday..

activeworkbook.Names("__ExpiryDate").delete

I will re-post my results tomorrow

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Phil C" wrote in message
...
Answer = 39100 ..if that makes any sense..

Phil


"Bob Phillips" wrote in message
...
As another thing, type this in the VBA immediate window when that file

is
open, and see what you get

?Evaluate(ThisWorkbook.Names("__ExpiryDate").Refer sTo)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Phil C" wrote in message
...
Hi Bob

Yes, I created an "evaluation period = 1 day" version last Friday (4

days
ago) and it still runs..

Phil



"Bob Phillips" wrote in message
...
Phil,

It actually allows 2 days because you are testing ExpiryDate < Date.

Have
you just not waited long enough?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Phil C" wrote in message
...
Hi Guys

Could someone please tell me what is wrong with the following

(placed
in
ThisWorkbook)?
I got the basic code from Bob Phillips via this NG, which worked

fine.
It
just stopped (closed imediately) after x days (with no message to

user)
All I have done is to set the trial.period to 1 day (for test

purposes)
and
added a few lines of message text using Msg.
Now the excel spreadsheet in question (Excel 2000) runs on beyond

the
trial
period...
I have also tried reducing the message box to 1 line (and other
irrational
things) but can no longer persude it to close!
Any ideas?

Thanks for your help

Phil

***************

Private Sub Workbook_Open()
Const sEDName As String = "__ExpiryDate"
Const nEvalPeriod As Long = 1
Dim ExpiryDate As Date
Dim sDate As String
Dim Msg 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
Msg = "The trial period has been exceeded." &

vbCrLf
Msg = Msg & "If you wish to continue using,

purchase
the
program via the website:" & vbCrLf
Msg = Msg & "website.com" & vbCrLf
MsgBox Msg
ThisWorkbook.Close savechanges:=False
End If
End If

End Sub












Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 - no "week" period available for chart formatting L-Man Charts and Charting in Excel 1 August 22nd 08 10:08 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Complex if test program possible? If "value" "value", paste "value" in another cell? jseabold Excel Discussion (Misc queries) 1 January 30th 06 10:01 PM
Can you "duplicate" "copy" listboxes and code to multiple cells? HotRod Excel Programming 1 September 1st 04 05:03 PM
Looking for VB code to test for "RING" , "BUSY" disconnects or other signals BruceJ[_2_] Excel Programming 3 November 20th 03 01:55 AM


All times are GMT +1. The time now is 01:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"