Pre-set Termination Date for Spreadsheet
Pre-set Termination Date for Spreadsheet
(OP)
Can anyone give me insight as to how to set up a spreadsheet with a termination date, or in other words a date after which the spreadsheet calculations will cease to function?
Greg Lamberson, BS, MBA
Consultant - Upstream Energy
Website: www.oil-gas-consulting.com





RE: Pre-set Termination Date for Spreadsheet
CODE
Dim wks As Worksheet
If Date > DateSerial(2007, 5, 24) Then
MsgBox "Sorry, spreadsheet expired..."
For Each wks In Me.Worksheets
wks.Range("A1", wks.UsedRange).Copy
wks.Range("A1").PasteSpecial xlPasteValues
wks.Range("A1").Select
Next wks
Application.CutCopyMode = False
End If
End Sub
However, if the user holds the Shift key while opening the file, the code doesn't get executed and the spreadsheet still works.
Alternatively, you could put all your proprietary calcs inside VBA procedures and check the date (or some flag) over there. There has been a lot of discussion in this forum already about protection strategies, so I won't repeat that here.
Cheers,
Joerd
Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.
RE: Pre-set Termination Date for Spreadsheet
If one proceeds as joerd outlines above, is there a way that the code can be hidden within the VBA editor?
RE: Pre-set Termination Date for Spreadsheet
RE: Pre-set Termination Date for Spreadsheet
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: Pre-set Termination Date for Spreadsheet
Not a big issue, was just wondering is all
RE: Pre-set Termination Date for Spreadsheet
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: Pre-set Termination Date for Spreadsheet
You can protect the VBA code, in my version go to Tools/VBA Project Properties/Protection, and complete the form.
Cheers,
Joerd
Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.