Date Validety on a file

V

Vikky

Hi experts;

I m using excel 2002.
Is it possible to give date vaildety to a excel file after that date
when anybody open that file excel would give Msg like " can not open
file. validety expired".

Thank you.

Regards;

Vikky
 
B

Bob Phillips

You could do something like

Private Sub Workbook_Open()
If Date > DateValue("12-Mar-2006") Then
MsgBox "Cannot open - expired"
ThisWorkbook.Close savechanges:=False
End If
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code

but a user can circumvent it by just disabling macros.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
V

Vikky

Thank you Bob for Replying.

I opened File,and pasted the code in view code, in all three sheets
code. But this is not giving desired result.

can you help me out, where i'm doing wrong.

Regards;

Vikky
 
H

Harald Staff

Hi Vikky

Workbook_open, and other workbook related events, goes in the ThisWorkbook
module, no in sheets' modules.

HTH. Best wishes Harald
 
B

Bob Phillips

Vikky,

I gave precise instruction to get to the correct code module.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
V

Vikky

Hi;

One more Question;

I've made a file with n No. of formulas.
Can we disable the formula function after a particuler date.

Thanks.

Regards;

Vikky
 
H

Harald Staff

You can make your formulas check the date
=IF(TODAY()<DATE(2006,8,8),SUM(A1:A100),"too late")
or you can create a macro that destroys stuff if the date is later than some
day.

But what you really ask is "can Excel protect my work" and the answer is no
way. You can keep unskilled users away from your secrets, but that's about
it. Excel protection is to protect against accidents, not to protect
content.

HTH. Best wishes Harald
 
Top