Learn Macros‎ > ‎VBA Macros‎ > ‎

Killing The Current File or Workbook

posted Jan 30, 2011, 5:59 AM by Ayush Jain   [ updated Jan 30, 2011, 6:04 AM by ayushjain@live.com ]
Killing the current file requires you to change it's status to read only.
Here is the code :

Sub Killed()
Application.DisplayAlerts=False
ThisWorkbook.ChangeFileAccess xlReadOnly
Kill ThisWorkbook.FullName
ThisWorkbook.Close False
End Sub

Comments