![]() |
deleting workbook on date????
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 -- Message posted from http://www.ExcelForum.com |
deleting workbook on date????
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). -- Regards, Tom Ogilvy "Simon Lloyd " wrote in message ... Does anyone have an idea how i can get a workbook to delete itself after 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 1 month before i send the real thing but i want the demo version to get automatically deleted so that there is no confusion. Can anyone help? Simon --- Message posted from http://www.ExcelForum.com/ |
deleting workbook on date????
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 -- Message posted from http://www.ExcelForum.com |
deleting workbook on date????
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 -- Message posted from http://www.ExcelForum.com |
deleting workbook on date????
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. -- Regards, Tom Ogilvy "Simon Lloyd " wrote in message ... Well i tried the code below, it does run the Killactive code but i get a pop up that asks me do i want to save changes before switching file types and whether you choose yes or no (i have tried displayalerts=false) the file closes but does not delete it self even 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 Sub --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 02:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com