Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kill file EW Excel Programming 4 August 29th 06 09:36 AM
Kill file EW Excel Programming 8 August 17th 06 03:32 AM
Kill a File Posse John Excel Programming 2 August 4th 06 02:23 PM
code to check file size everytime an Excel file is opened Kaiser[_2_] Excel Programming 2 July 30th 06 05:46 PM
stop excel file opened as read only if already opened by another u bobm Excel Programming 3 August 5th 05 04:11 PM


All times are GMT +1. The time now is 10:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"