ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dealing with date formats on expiration date (https://www.excelbanter.com/excel-programming/398728-dealing-date-formats-expiration-date.html)

bliten_bsas

Dealing with date formats on expiration date
 
Hi,

I've coded my model so that it is no longer usable after a defined
expiration date by using the following:

Sub auto_open()
Dim ExpiryDate As Date

ExpiryDate = "4-Ene-2008"

If Date ExpiryDate Then
MsgBox ("The trial time has expired")
ThisWorkbook.Close savechanges:=False
End If

This code works just fine on my computer. However, I'm afraid the
defined value for the ExpiryDate variable (in this case is "4-
Ene-2008") might not be recognized on a different computer due to
regional specifications (the month could be read as "Jan" rather than
"Ene", the spanish equivalent). How could I define a date that can be
understood by any computer in the world?


Ron de Bruin

Dealing with date formats on expiration date
 
Hi

You can use

If Date DateSerial(2003, 4, 1) Then


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"bliten_bsas" wrote in message ups.com...
Hi,

I've coded my model so that it is no longer usable after a defined
expiration date by using the following:

Sub auto_open()
Dim ExpiryDate As Date

ExpiryDate = "4-Ene-2008"

If Date ExpiryDate Then
MsgBox ("The trial time has expired")
ThisWorkbook.Close savechanges:=False
End If

This code works just fine on my computer. However, I'm afraid the
defined value for the ExpiryDate variable (in this case is "4-
Ene-2008") might not be recognized on a different computer due to
regional specifications (the month could be read as "Jan" rather than
"Ene", the spanish equivalent). How could I define a date that can be
understood by any computer in the world?



All times are GMT +1. The time now is 05:07 AM.

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