PDA

View Full Version : Solved: Delete workbook on date....



Mr.G
05-26-2009, 12:30 AM
Hi

I found a KB entry "WorkbookSuicide". I am wondering if these will work with it.

On Sheet 1 Cell A1, = TODAY()

Then on Workbook Open,

Private Sub Workbook_Open()
If Cells("A:1").Value = 27 / 5 / 2009 Then
Call KillMe
End If
End Sub


KillMe KB23

Would be very nice.....easy to crack yes but still worthwhile.

Regards

mdmackillop
05-26-2009, 12:35 AM
Your celll reference style is incorrect and the date as written is not seen as a date in VBA. Check out the VBA Help for both these issues.

Mr.G
05-26-2009, 12:40 AM
Thanks I'll have a look and if not suceed ,I'll be back.

Bob Phillips
05-26-2009, 01:40 AM
Your celll reference style is incorrect and the date as written is not seen as a date in VBA. Check out the VBA Help for both these issues.

... and the Kill syntax is wrong

... and you cannot kill the activeworkbook that easily

Mr.G
05-26-2009, 05:32 AM
Got it!!!......and it works very nicely.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("C1") = Date
Range("A1").Select
If Range("C1") = "26/05/2009" Then
Call KillMe
End If
End Sub

If anyone wants to have a look. Please do it in a workbook that can be deleted.

Regards
G