View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Date check for expiration

The Date method doesn't return the time. It returns only the Date. Time
returns only the Time, and Now returns both.

What's in foglio1!A1?



In article .com,
"A" wrote:

Hello,
I'd like to insert a simple protection into my Excel file. For example
I'd like to

-check the current DATE that file is opened
-if it is opened after a particular date the applications quits.

Ok, I now is very easy to unprotect but it's better that no protection
at all. (and I know
they can disable macro at start)

Something like this doesn't work:


Sub Apri_Open()

If Date Worksheets("foglio1").Range("A1") Then
MsgBox ("expired")
ThisWorkbook.Close
End If
End Sub

Because date() returns the time also.

Thanks,
Ale.