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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

dantb

Active Member
Joined
Mar 20, 2002
Messages
358
Dont know if it would help but I have a vb that limits times open.
 

zzydhf

Board Regular
Joined
Apr 10, 2002
Messages
236
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.
 

imported_unknown

Active Member
Joined
Jan 13, 2002
Messages
424
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
 

mnmhenry

Board Regular
Joined
Mar 28, 2002
Messages
167

ADVERTISEMENT

I have a beuty but I don't have it with me ...Sorry.

E-mail me at mnmhenry@tpg.com.au and I'll return the info. ...I'm not on my machine and I can't remember the code ...hehe

Mark.
 

imported_unknown

Active Member
Joined
Jan 13, 2002
Messages
424
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. :)
 

stevebausch

Well-known Member
Joined
May 11, 2002
Messages
810

ADVERTISEMENT

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.
 

colleen

Board Regular
Joined
Feb 21, 2002
Messages
61
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.
 

Richie(UK)

MrExcel MVP
Joined
May 17, 2002
Messages
3,329
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
 

Forum statistics

Threads
1,144,112
Messages
5,722,539
Members
422,446
Latest member
jsasiadek35

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
Top