+ Reply to Thread
Results 1 to 3 of 3

Delete a file

  1. #1
    Dave Dawson
    Guest

    Delete a file

    I'm processing a series of report files to turn them into tables, saving the
    tables (workbooks), combining the tables into one composite workbook. This
    will happen daily. I want to avoid the irritating messages that a file with
    this name already exists. I don't see any way to make the .saveas prevent
    that, and haven't found a reliable way to delete the files just before the
    ..saveas.

    I thought surely the shell() function would do it with "del filename.ext",
    but it didn't want to hear that. I even made a batch file to delete the
    files, but it does it the first time through the program, then quits. It
    seems there should be a more elegant way than a batch file anyway.

    What am I missing?

    Thanks,
    Dave Dawson



  2. #2
    Chris Mahoney
    Guest

    Re: Delete a file

    There's a Kill command that can delete a file. Help seems to have plenty of
    information on it.

    Chris


    On 4/2/05 2:40 PM, in article [email protected], "Dave
    Dawson" <[email protected]> wrote:

    > I'm processing a series of report files to turn them into tables, saving the
    > tables (workbooks), combining the tables into one composite workbook. This
    > will happen daily. I want to avoid the irritating messages that a file with
    > this name already exists. I don't see any way to make the .saveas prevent
    > that, and haven't found a reliable way to delete the files just before the
    > .saveas.
    >
    >
    > I thought surely the shell() function would do it with "del filename.ext",
    > but it didn't want to hear that. I even made a batch file to delete the
    > files, but it does it the first time through the program, then quits. It
    > seems there should be a more elegant way than a batch file anyway.
    >
    > What am I missing?
    >
    > Thanks,
    > Dave Dawson
    >
    >



  3. #3
    Jim Thomlinson
    Guest

    RE: Delete a file

    You want the kill function.

    kill "C:\Myfile.txt"

    You can also use file system objects but that is a lot more work than you
    need. To get rid of the annoying message use this line of code:

    application.displayalerts = false

    be usre to turn it back on when you are done...

    application.displayalerts = true

    HTH

    "Dave Dawson" wrote:

    > I'm processing a series of report files to turn them into tables, saving the
    > tables (workbooks), combining the tables into one composite workbook. This
    > will happen daily. I want to avoid the irritating messages that a file with
    > this name already exists. I don't see any way to make the .saveas prevent
    > that, and haven't found a reliable way to delete the files just before the
    > ..saveas.
    >
    > I thought surely the shell() function would do it with "del filename.ext",
    > but it didn't want to hear that. I even made a batch file to delete the
    > files, but it does it the first time through the program, then quits. It
    > seems there should be a more elegant way than a batch file anyway.
    >
    > What am I missing?
    >
    > Thanks,
    > Dave Dawson
    >
    >
    >


+ 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