+ Reply to Thread
Results 1 to 5 of 5

correction

  1. #1
    Forum Contributor
    Join Date
    05-27-2004
    Posts
    119

    correction

    Hi all,
    I have the following code
    Range("A5,A4").ClearContents
    Range("A4").Select
    Windows("MICR.xls").Activate
    Range("N2").Select
    Windows("MICR PRINT.xls").Activate
    ActiveCell.FormulaR1C1 = "=MICR.xls!R2C14"
    Range("B4").Select
    Sheets("DA").Select
    Range("A9,A10,A11").ClearContents
    Range("A10").Formula = "=Spellnumber(A9)"
    Range("A9").Select
    Windows("MICR PRINT.xls").Activate
    ActiveCell.FormulaR1C1 = "=MICR.xls!R2C15"
    Range("A2").Select
    Sheets("SA").Select
    Range("A9,A10,A11").ClearContents
    Range("A10").FormulaR1C1 = "=SPELLNUMBER(R[-1]C,""INR"")"
    Range("A9").Select
    Windows("MICR PRINT.xls").Activate
    ActiveCell.FormulaR1C1 = "=MICR.xls!R2C15"
    Range("A2").Select
    Sheets("MICRI").Select
    Range("A1").Select
    ActiveWorkbook.Save
    Windows("MICR.xls").Activate
    ActiveWorkbook.Close

    In this final 2 lines i wanted a change instead of ActiveWorkbook.close
    i wanted to delete the MICR.xls file which is in C:My Document, i tried .Delete
    Any other alternate for this
    with regards
    nowfal

  2. #2
    Ardus Petus
    Guest

    Re: correction

    Kill "C:\My Documents\MICR.xls""

    HTH
    --
    AP

    "nowfal" <[email protected]> a écrit dans
    le message de news:[email protected]...
    >
    > Hi all,
    > I have the following code
    > Range("A5,A4").ClearContents
    > Range("A4").Select
    > Windows("MICR.xls").Activate
    > Range("N2").Select
    > Windows("MICR PRINT.xls").Activate
    > ActiveCell.FormulaR1C1 = "=MICR.xls!R2C14"
    > Range("B4").Select
    > Sheets("DA").Select
    > Range("A9,A10,A11").ClearContents
    > Range("A10").Formula = "=Spellnumber(A9)"
    > Range("A9").Select
    > Windows("MICR PRINT.xls").Activate
    > ActiveCell.FormulaR1C1 = "=MICR.xls!R2C15"
    > Range("A2").Select
    > Sheets("SA").Select
    > Range("A9,A10,A11").ClearContents
    > Range("A10").FormulaR1C1 = "=SPELLNUMBER(R[-1]C,""INR"")"
    > Range("A9").Select
    > Windows("MICR PRINT.xls").Activate
    > ActiveCell.FormulaR1C1 = "=MICR.xls!R2C15"
    > Range("A2").Select
    > Sheets("MICRI").Select
    > Range("A1").Select
    > ActiveWorkbook.Save
    > Windows("MICR.xls").Activate
    > ActiveWorkbook.Close
    >
    > In this final 2 lines i wanted a change instead of
    > ActiveWorkbook.close
    > i wanted to delete the MICR.xls file which is in C:My Document, i tried
    > Delete
    > Any other alternate for this
    > with regards
    > nowfal
    >
    >
    > --
    > nowfal
    > ------------------------------------------------------------------------
    > nowfal's Profile:

    http://www.excelforum.com/member.php...o&userid=10003
    > View this thread: http://www.excelforum.com/showthread...hreadid=526010
    >




  3. #3
    Forum Contributor
    Join Date
    05-27-2004
    Posts
    119
    Hi Ardus Petus,
    I have tried the "kill" , but the file is still there in my document. I wanted to delete the file micr.xls for good.
    thx and regards
    nowfal

  4. #4
    BrianH
    Guest

    RE: correction

    "Delete" is a VBA Method applied to various Objects within Excel - it will
    not delete a file from the disk.

    "Kill" as per Ardus's post should work. It is a VB command dealing with the
    computer's file system. But I think if you try to replace
    ActiveWorkbook.Close with Kill, nothing will happen because the file is still
    open, and so the operating system won't let it be deleted from the disk. You
    must first Close the file, and then Kill it.

    (You'll get a "Cannot delete . . ." error message if you try to delete an
    open file in Windows Explorer, but if my memory serves me correctly, Kill
    gives no warnings, it just doesn't do anything if it's an illegal command.)

    BrianH


    "nowfal" wrote:

    >
    > Hi all,
    > I have the following code
    > Range("A5,A4").ClearContents
    > Range("A4").Select
    > Windows("MICR.xls").Activate
    > Range("N2").Select
    > Windows("MICR PRINT.xls").Activate
    > ActiveCell.FormulaR1C1 = "=MICR.xls!R2C14"
    > Range("B4").Select
    > Sheets("DA").Select
    > Range("A9,A10,A11").ClearContents
    > Range("A10").Formula = "=Spellnumber(A9)"
    > Range("A9").Select
    > Windows("MICR PRINT.xls").Activate
    > ActiveCell.FormulaR1C1 = "=MICR.xls!R2C15"
    > Range("A2").Select
    > Sheets("SA").Select
    > Range("A9,A10,A11").ClearContents
    > Range("A10").FormulaR1C1 = "=SPELLNUMBER(R[-1]C,""INR"")"
    > Range("A9").Select
    > Windows("MICR PRINT.xls").Activate
    > ActiveCell.FormulaR1C1 = "=MICR.xls!R2C15"
    > Range("A2").Select
    > Sheets("MICRI").Select
    > Range("A1").Select
    > ActiveWorkbook.Save
    > Windows("MICR.xls").Activate
    > ActiveWorkbook.Close
    >
    > In this final 2 lines i wanted a change instead of
    > ActiveWorkbook.close
    > i wanted to delete the MICR.xls file which is in C:My Document, i tried
    > .Delete
    > Any other alternate for this
    > with regards
    > nowfal
    >
    >
    > --
    > nowfal
    > ------------------------------------------------------------------------
    > nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003
    > View this thread: http://www.excelforum.com/showthread...hreadid=526010
    >
    >


  5. #5
    Forum Contributor
    Join Date
    05-27-2004
    Posts
    119
    Hi Brian,
    You are absolutely right. I have tried by your way, then the file got deleted from the my document itself. Thanks once again both of you.
    with regards
    NOWFAL

+ 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