+ Reply to Thread
Results 1 to 5 of 5

Delete Excel File

Hybrid View

  1. #1
    Richard
    Guest

    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.

  2. #2
    Muhammed Rafeek M
    Guest

    RE: 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.


  3. #3
    Muhammed Rafeek M
    Guest

    RE: 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.


  4. #4
    Richard
    Guest

    RE: 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.


  5. #5
    Muhammed Rafeek M
    Guest

    RE: 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.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1