Hi
you will need to run a macro on opening, and also one on closing tha
saves the file automatically if you want to record the time of the mos
recent access (though I'm not sure why - won't the time now always b
after the time the file was last accessed?).
the auto-open and auto_close macros run automatically whenever the fil
opens and closes. The attached sheet includes a sort of worked example
with the sheet named "hid" containing data you would hide, and th
macros running to check dates on opening, then closing if the expir
date has passed unless the correct passwor "excelforum" is entered.
The macros a
Sub AUTO_OPEN()
If Date Sheets("hid").Range("expiry_date").Value Then
resp = InputBox("sorry, your trial has expired." & Chr(10) & "You mus
enter a password to continue working in this workbooket", "Ente
password", resp)
If LCase(resp) < LCase(Sheets("hid").Range("password").Value) The
ActiveWorkbook.Close
End If
End Sub
Sub AUTO_Close()
Sheets("hid").Range("last_opened").Value = Now()
Sheets("hid").Range("times_opened").Value = 1
Sheets("hid").Range("times_opened").Value
If ActiveWorkbook.Saved = False Then ActiveWorkbook.Save
End Su
Attachment filename: test.xls
Download attachment:
http://www.excelforum.com/attachment.php?postid=44732
--
Message posted from
http://www.ExcelForum.com