View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Muhammed Rafeek M Muhammed Rafeek M is offline
external usenet poster
 
Posts: 179
Default Delete Excel File

Try this one
Sub Deletes()
dim strFN as string

strFN = "C:\" & ActiveWorkbook .Worksheets("Sheet1").Range("B11").Value &
".xls"
Kill strFN

End Sub


"Richard" wrote:

I tried what you suggested, however still being a novice, I am making some
error, the following is my code:

Sub Deletes()
'
' Delete Macro
' Macro recorded 8/22/2006 by RSabbara
'

'
Kill
Path = "C:"
With ActiveWorkbook
Workbooks.Open Filename:=Path & .Worksheets("Sheet1").Range("B11").Value &
".xls"

End Sub


What am I missing?

Thank you.

Richard

"Muhammed Rafeek M" wrote:

' Assume TESTFILE is a file containing some data.
Kill "TestFile" ' Delete file.

' Delete all *.TXT files in current directory.
Kill "*.TXT"



"Richard" wrote:

I have a spreadsheet with the pathname of the files that I want deleted,
anyway to do this in a macro? So much of what I have done is already
automated, this is one of the final steps in this project.