LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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/





 
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 04:18 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"