Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 - no "week" period available for chart formatting | Charts and Charting in Excel | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Complex if test program possible? If "value" "value", paste "value" in another cell? | Excel Discussion (Misc queries) | |||
Can you "duplicate" "copy" listboxes and code to multiple cells? | Excel Programming | |||
Looking for VB code to test for "RING" , "BUSY" disconnects or other signals | Excel Programming |