deleting workbook on date????

  • Thread starter Thread starter Simon Lloyd
  • Start date Start date
S

Simon Lloyd

Does anyone have an idea how i can get a workbook to delete itself afte
a certain date? i.e if today>= 25/8/04 then ?????

It's for a demo version of a workbook that i want to send out for
month before i send the real thing but i want the demo version to ge
automatically deleted so that there is no confusion.

Can anyone help?


Simo
 
Generally, deleting things on another users computer is equivalent to virus
activity.

Sub KillActive()
On Error Resume Next
sName = ActiveWorkbook.FullName
ActiveWorkbook.ChangeFileAccess xlReadOnly
Kill sName
ActiveWorkbook.Close SaveChanges:=False
End Sub

is how you would do it if you want to have it delete itself. (which I assume
is the case).
 
Thanks Tom,

I do understand your concerns with regards the "virus activity" bu
this is within my company network and having a fair few technophobes
know that they will try to update or make changes to the demo versio
if they still had it and then all record keeping would go up the wall!

In my auto_open would i have ......if today = "26/8/04" then cal
Killactive end if

as i only want it to delete one month from issue as the working versio
will be in place then.

Thanks,

Simo
 
Well i tried the code below, it does run the Killactive code but i get
pop up that asks me do i want to save changes before switching fil
types and whether you choose yes or no (i have trie
displayalerts=false) the file closes but does not delete it self eve
if i put this code in the auto_open. Any thoughts???

Simon

Sub Auto_close()
Dim MyDate
MyDate = #8/26/2004#
If Date >= MyDate Then
Call KillActive
End If
End Sub

Sub KillActive()
On Error Resume Next
demomatrix.xls = ActiveWorkbook.FullName
ActiveWorkbook.ChangeFileAccess xlReadOnly
Kill demomatrix.xls
ActiveWorkbook.Close SaveChanges:=False
End Su
 
Sub KillActive()
dim sName as String
On Error Resume Next
sName = ThisWorkbook.FullName
Application.DisplayAlerts = False
ThisWorkbook.ChangeFileAccess xlReadOnly
Kill sName
Application.DislayAlerts = True
ThisWorkbook.Close SaveChanges:=False
End Sub

worked for me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top