![]() |
Delete Excel File
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. |
Delete Excel File
use KILL command
"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. |
Delete Excel File
' 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. |
Delete Excel File
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. |
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. |
All times are GMT +1. The time now is 12:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com