Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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/





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
deleting workbook saqib New Users to Excel 1 June 24th 08 03:22 PM
Deleting Workbook from others Julia Excel Worksheet Functions 2 April 22nd 08 06:34 PM
Deleting workbook SidBord Excel Programming 0 July 14th 04 07:52 PM
Deleting workbook Tom Ogilvy Excel Programming 0 July 14th 04 03:50 PM
Deleting Workbook Fred[_16_] Excel Programming 2 November 26th 03 06:33 PM


All times are GMT +1. The time now is 07:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"