View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
Tim Zych Tim Zych is offline
external usenet poster
 
Posts: 389
Default Can A Workbook Delete Itself


Combination of a macro I wrote to do just this and what I have read online.

--
Regards,
Tim Zych
http://www.higherdata.com
Workbook Compare - Excel data comparison utility

"BillCPA" <Bill @ UAMS wrote in message
...
That's awesome. How did you discover that?

--
Bill @ UAMS


"Tim Zych" wrote:

Sure.

In the ThisWorkbook module:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
With ThisWorkbook
On Error Resume Next
.ChangeFileAccess xlReadOnly
Kill .FullName
On Error GoTo 0
.Close False
End With
End Sub

you can add better code which can check for the existence of the
workbook,
rather than using On Error Resume Next, but this is the basic idea.

--
Regards,
Tim Zych
http://www.higherdata.com
Workbook Compare - Excel data comparison utility


"BillCPA" <Bill @ UAMS wrote in message
...
Is it possible for a workbook to delete itself when it closes?

--
Bill @ UAMS