write at exceltoexplore@gmail.com : Report Automation|Dashboard in Excel| Provide Excel consulting through macro (VBA) automation |Financial Modeling | Ethical Hacking

Tuesday, 21 February 2012

Create Expiry for Excel Workbook

Some times you have to set expiry date for your excel workbook. which will restrict use of workbook after certain period of time.  

  1. Press "Alt+F11" to launch the Visual Basic Editor from Excel
  2. Right-click "ThisWorkbook" in the "Project Explorer" window. Select "View Code" from the list of available options
  3. copy below code
Private Sub Workbook_Open()
'If Sheets("sheet1").Range("a1").Value < Date Then ' you can set value on worksheet
If doe < Date Then 'You can define date as doe
MsgBox "This tool has expired, please contact Admin.", vbCritical, "Expired"
ActiveWorkbook.Close False
End If
End Sub

1 comment:

  1. Excellent and decent post. I found this much informative, as to what I was exactly searching for. Thanks for such post and keep it up.