need a time bomb for vba

imported_unknown

Active Member
Joined
Jan 13, 2002
Messages
424
I've got an Excel spreadsheet that has been developed over the years. It has loads of macro's and vba. I won't get into the details (mostly political) unless you ask, but I need to be able to ship a spreadsheet that will quit functioning after 7 months.

Can anyone point me to a solution out there?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
here is a simple one to try:

you can make a simple auto_open that checks today() verses the first time opened (that will have to be written in a hidden sheet) and if today() > 1st opened + 7 months then do an application.close. Make sure you protect the code so it can't be changed.
 
Upvote 0
You could also add this so when the time passes it will delete the your workbook all together.Be sure to have a backup copy when testing.
Sub Suicide()
Dim FName As String
Dim Ndx As Integer
With ThisWorkbook
.Save
For Ndx = 1 To Application.RecentFiles.Count
If Application.RecentFiles(Ndx).Path = .FullName Then
Application.RecentFiles(Ndx).Delete
Exit For
End If
Next Ndx
.ChangeFileAccess Mode:=xlReadOnly
Kill .FullName
.Close SaveChanges:=False
End With
End Sub
 
Upvote 0
Hey...that suicide one is neat! But I'm trying to leave the spreadsheet in tact...but delete all the vba code in the background...that way it will just quit working after 7 months. :)
 
Upvote 0
I need to say this, first, just in case my co-workers are lurking here.

I would NEVER timebomb a workbook that others are depending on.

Demo versions? Nobody should be depending on a demo version. Timebomb away. Microsoft does it with their demos. Why not others?

Well, whatever you do, it shouldn't flag on virus scanners. Test your code on an up-to-date scanner, to make sure it doesn't flag.

I think anything that deletes/modifies code will flag a scanner, and most definitely it will flag in Excel XP 2002.

I would think the code for a conventional "timebomb" goes like this:

Save the date of initial run/date of disablement, perhaps in an outermost cell of each worksheet. Restrict the ScrollArea of all sheets, have the value in "white ink".

Test for the value, or a combination of values. A CRC check sounds appropriate.

As long as the value(s) are good, then run the workbook.

If the values are corrupted/CRC doesn't come back good, then pop-up a "Goodbye" message, close the workbook.

I would also change all the variable/Routine names to two letter variables. "AA" to "ZZ" would give 600 + names.
 
Upvote 0
how do you incorporate the "sucide" module with the date. so that it is incorporated in the sucide program thus when the date the date is reached it triggers the program. and how can I hide this program as I have several macros which I cannot hide.
 
Upvote 0
Hi colleen,

Try something like this (suicide code commented-out for testing purposes!)

<pre>
Sub Suicide()
Dim FName As String
Dim Ndx As Integer
Dim SuicideDate As Date

SuicideDate = 37560 '31 October 2002

If SuicideDate > Now() Then Exit Sub

'With ThisWorkbook
'.Save
'For Ndx = 1 To Application.RecentFiles.Count
'If Application.RecentFiles(Ndx).Path = .FullName Then
'Application.RecentFiles(Ndx).Delete
'Exit For
'End If
'Next Ndx
'.ChangeFileAccess Mode:=xlReadOnly
'Kill .FullName
'.Close SaveChanges:=False
'End With

MsgBox "Delete code would have run!"

End Sub</pre>

Not sure what you mean by hiding - have you tried locking the VBA project?

HTH
 
Upvote 0

Forum statistics

Threads
1,218,690
Messages
6,143,940
Members
450,516
Latest member
shironokuro

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top