Delete (kill) active workbook on close: Possible?
Bob,
As a friendly suggestion, the error handler message box mentions "delete"ing
the file. I don't believe the code you posted actually "deletes" the file,
instead, it just unloads it, kills it, etc. If the file were "deleted" I
would not be able to open/run the file at a later date. Unloading/Killing
the file simply means I would need to load it from storage(disk) again at my
convienience.
Sincerely,
Christmas May
"Bob Phillips" wrote:
On Error GoTo ErrorHandler
With ActiveWorkbook
If .Path < "" Then
.Saved = True
.ChangeFileAccess xlReadOnly
Kill ActiveWorkbook.FullName
End If
End With
Exit Sub
ErrorHandler:
MsgBox "Fail to delete file: " & ActiveWorkbook.FullName
Exit Sub
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"BEEJAY" wrote in message
...
Have a file I call Updater. Sent out with File F2
Updater takes info from F1, copies to F2.
When process complete, I'd like Updater to be killed,
but it is the active workbook.
Is there a way to kill a file on closing?
|