![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 3
|
I am working on a microsoft EXCEL file. This file contains calculations.
I want to distribute this file through my website but at the same time I want my clients to download new version every six months. Now the problem is that I want this excel file to stop working on a specified future date. It could be in either way: - to lock the file automatically on a specified date; or - to delete the file on a specified date; or - to lock and show a specified worksheet only with message that the file has expired and how to get new version - to lock all sheets except one etc....... Please help me how to do this. Any other way to get this function and the results... Imran Rashid http://www.exportfinance.com.pk |
|
|
|
|
|
#2 | |
|
Board Regular
Join Date: Mar 2002
Location: England, UK.
Posts: 526
|
Quote:
|
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Location: Houston, TX
Posts: 60
|
Easiest thing to try would be to add some code in the Workbook_Open event, first thing, test the date against your die date, and prompt a msg then exit the workbook.
If Now() >= CDate("6/27/02") then MsgBox "Get a new copy" me.close end if |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
You could check at open the date versus the date that the file stops working, which could be located in a hidden sheet, or in the registry or in a text file...
One thing, Excel isn't the most secure tool... what I mean is, if someone wants to get it, they can. |
|
|
|
|
|
#5 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi imranrashid
There quite a few ways this could be done, most far from fool-proof though. The code below is just one of many ways. This code must be placed in the Private Module of "ThisWorkbook". Private Sub Workbook_Open() Dim stPass As String Dim stDate As String Dim wsSheet As Worksheet On Error Resume Next Application.DisplayAlerts = False Sheets.Add().Name = "DateChecker" If ActiveSheet.Name <> "DateChecker" Then ActiveSheet.Delete Sheets("DateChecker").Visible = xlVeryHidden If Sheets("DateChecker").Range("A1") = "" Then Sheets("DateChecker").Range("A1") = Date Me.Save End If If Sheets("DateChecker").Range("A1") + 30 > Date Then Sheets.Add before:=Sheets(1) For Each wsSheet In Me.Worksheets If wsSheet.Index <> 1 Then wsSheet.Delete Next wsSheet Application.DisplayAlerts = True Me.Save End If End Sub The code will add the date to a hidden sheet the first time they open the file. From then on it will check the date each time they open. If the date on the hidden sheet is greater than 30 days old the code adds a sheet(Excel requires at least one visible sheet), then deletes all others. This may of course be a bit dramatic for your needs, but hopefully it will get you started. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|