Thread: [Solved] Kill the file based on date
View Single Post
 
Old 07-14-2014, 03:47 AM
Villalobos Villalobos is offline Windows 8 Office 2013
Novice
 
Join Date: Jul 2014
Posts: 7
Villalobos is on a distinguished road
Default

Hello macropod,

My target would be that if the actual date is higher than the pre-definied date (the date is definied in the code), then the code automatically delete the file. The code would be link with the document_open event.

Basicly this that code which is working in Excel and I would like to integrate into Word.

Option Explicit
Private Sub Workbook_open()
If date > “2014.07.14” then
With ThisWorkbook
.Saved = True
.ChangeFileAccess xlReadOnly
Kill .FullName
Application.Quit
End With
End if
End Sub
Reply With Quote