Expiring the Old program in Excel.

  • Thread starter Premanand Sethuraman
  • Start date
P

Premanand Sethuraman

Dear All,
I'm making some programs (Excel with VBA) for Engineers use.
I will revise the program every 6 months and send it to my branch people
(Engineers)
The problem is even though I'm mentioing my revision every time in my
program, some time our people may forget and they are using the old version.
I'm asking them to delete the old version and use the latest but in vain.

I just want to ask one thing whether we can able to provide some expiry date
for that program (in the form of VB Coding) so that even though if the people
use the old version, it wil never open (or) activate. Hence people may aware
to use the latest version.
Is it Possible in EXCEL WITH VBA?
Please advise.
Regards,
Anand.
 
N

NickHK

You could may use something with BuiltinDocumentProperties and CreationDate
in the Workbook_Open and test if
< DateAdd("m", -6, Now())
Check the help for these terms.

NickHK
 
P

Premanand Sethuraman

Dear Nick,
Thanks for your immediatel treply.
I tried this with "minutes" to expire but it is not working. I've given the
codings here

Private Sub Workbook_Open()
Dim dat As Date
dat = 27 / 11 / 2006
If dat > DateAdd("m", 5, "27/11/2006") Then
MsgBox ("This program is expired. Please contact H.O for revised Program")
ActiveWorkbook.Close
Else
End If
End Sub

Please advise me how should I modify?
Regards,
Anand.
 
N

NickHK

Try these.

- What value do you get for CLng(dat) ?
Does it = 0 ?
What is the value of 27 divided by 11 divided by 2007 ?

- Using a date literal in VBA, you need to enclose it in #..date..#
However, depending on the user's Short Date settings (dd/mm/yy v. mm/dd/yy),
this could yield the wrong date, although in this case it will not, as there
is no 27th month
To be clear use:
DateSerial(2007, 11, 27)

- "m" means months, not minutes. That is "n". Check the help for DateAdd.

-Your logic on the date comparison is wrong. Assuming a 6 month expiration
date, you something like :
dat=dateSerial(2007,4,27)
If DateAdd("m", 6, dat) < Now() Then

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top