ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date check for expiration (https://www.excelbanter.com/excel-programming/387428-date-check-expiration.html)

A[_4_]

Date check for expiration
 
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.


JE McGimpsey

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.



All times are GMT +1. The time now is 07:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com