Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Las Vegas, Nevada, USA
    Thanked 0 Times in 0 Posts

    Back to DOS (system) (Excel 97)

    I'd like to include into a macro a DOS command that deletes specific files stored in C:Temp. Something like what I started below

    Sub DeleteC_Temp_StatsDOR()
    ChDir "C:TEMP"
    Del "C:tempStore stat*.xls"
    Del "C:tempDOR E-Mail*.xls"
    End Sub

    These are files which I receive daily and link to for certain cell values. But my formulas get confused when Excel adds a "1" to the back of the filename if I haven't first deleted the previous C:Temp file.

    THX in advance for your assistance.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Back to DOS (system) (Excel 97)

    In VBA, the equivalent instructions would be:

    ChDrive "C"
    ChDir "C:Temp"
    Kill "Store stat*.xls"
    Kill "DOR E-Mail*.xls"

    But if you specify a path in Kill, you don't need ChDrive and ChDir:

    Kill "C:TempStore stat*.xls"
    Kill "C:TempDOR E-Mail*.xls"

Posting Permissions

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