![]() |
Kill a opened Excel File
Hi, 1. Please let me know how to kill the opened file permanently by a macro. and I have an other folder name TempReports on C:\shahzad\reports \TempReports 2. I want to delete all files of the TempReports folder at once by running a single macro. please send me reply, thanks in advance. Regards. Shahzad |
Kill a opened Excel File
Hi Shazi
1: Change ChangeFileAccess ActiveWorkbook.ChangeFileAccess xlReadOnly Kill ActiveWorkbook.FullName ActiveWorkbook.Close False 2: http://www.rondebruin.nl/folder.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Shazi" wrote in message ... Hi, 1. Please let me know how to kill the opened file permanently by a macro. and I have an other folder name TempReports on C:\shahzad\reports \TempReports 2. I want to delete all files of the TempReports folder at once by running a single macro. please send me reply, thanks in advance. Regards. Shahzad |
Kill a opened Excel File
Try 1) With Workbooks("Book4.xls") .ChangeFileAccess xlReadOnly Kill .FullName End With 2) Dim FF As Object Dim FSO As Object Set FSO = CreateObject("Scripting.FileSystemObject") Set FF = FSO.getfolder("C:\Test") FF.Delete This will destroy the folder C:\Test and all its contents. If you want to folder C:\Test to remain, use MkDir to create it after deletion. Dim FF As Object Dim FSO As Object Set FSO = CreateObject("Scripting.FileSystemObject") Set FF = FSO.getfolder("C:\Test") FF.Delete MkDir "C:\Test" Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Tue, 27 Jan 2009 14:29:43 -0800 (PST), Shazi wrote: Hi, 1. Please let me know how to kill the opened file permanently by a macro. and I have an other folder name TempReports on C:\shahzad\reports \TempReports 2. I want to delete all files of the TempReports folder at once by running a single macro. please send me reply, thanks in advance. Regards. Shahzad |
All times are GMT +1. The time now is 05:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com