Hi all,
I have the following code
Range(quot;A5,A4quot;).ClearContents
Range(quot;A4quot;).Select
Windows(quot;MICR.xlsquot;).Activate
Range(quot;N2quot;).Select
Windows(quot;MICR PRINT.xlsquot;).Activate
ActiveCell.FormulaR1C1 = quot;=MICR.xls!R2C14quot;
Range(quot;B4quot;).Select
Sheets(quot;DAquot;).Select
Range(quot;A9,A10,A11quot;).ClearContents
Range(quot;A10quot;).Formula = quot;=Spellnumber(A9)quot;
Range(quot;A9quot;).Select
Windows(quot;MICR PRINT.xlsquot;).Activate
ActiveCell.FormulaR1C1 = quot;=MICR.xls!R2C15quot;
Range(quot;A2quot;).Select
Sheets(quot;SAquot;).Select
Range(quot;A9,A10,A11quot;).ClearContents
Range(quot;A10quot;).FormulaR1C1 = quot;=SPELLNUMBER(R[-1]C,quot;quot;INRquot;quot;)quot;
Range(quot;A9quot;).Select
Windows(quot;MICR PRINT.xlsquot;).Activate
ActiveCell.FormulaR1C1 = quot;=MICR.xls!R2C15quot;
Range(quot;A2quot;).Select
Sheets(quot;MICRIquot;).Select
Range(quot;A1quot;).Select
ActiveWorkbook.Save
Windows(quot;MICR.xlsquot;).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: www.excelforum.com/member.php...oamp;userid=10003
View this thread: www.excelforum.com/showthread...hreadid=526010Kill quot;C:\My Documents\MICR.xlsquot;quot;
HTH
--
AP
quot;nowfalquot; gt; a écrit dans
le message de ...
gt;
gt; Hi all,
gt; I have the following code
gt; Range(quot;A5,A4quot;).ClearContents
gt; Range(quot;A4quot;).Select
gt; Windows(quot;MICR.xlsquot;).Activate
gt; Range(quot;N2quot;).Select
gt; Windows(quot;MICR PRINT.xlsquot;).Activate
gt; ActiveCell.FormulaR1C1 = quot;=MICR.xls!R2C14quot;
gt; Range(quot;B4quot;).Select
gt; Sheets(quot;DAquot;).Select
gt; Range(quot;A9,A10,A11quot;).ClearContents
gt; Range(quot;A10quot;).Formula = quot;=Spellnumber(A9)quot;
gt; Range(quot;A9quot;).Select
gt; Windows(quot;MICR PRINT.xlsquot;).Activate
gt; ActiveCell.FormulaR1C1 = quot;=MICR.xls!R2C15quot;
gt; Range(quot;A2quot;).Select
gt; Sheets(quot;SAquot;).Select
gt; Range(quot;A9,A10,A11quot;).ClearContents
gt; Range(quot;A10quot;).FormulaR1C1 = quot;=SPELLNUMBER(R[-1]C,quot;quot;INRquot;quot;)quot;
gt; Range(quot;A9quot;).Select
gt; Windows(quot;MICR PRINT.xlsquot;).Activate
gt; ActiveCell.FormulaR1C1 = quot;=MICR.xls!R2C15quot;
gt; Range(quot;A2quot;).Select
gt; Sheets(quot;MICRIquot;).Select
gt; Range(quot;A1quot;).Select
gt; ActiveWorkbook.Save
gt; Windows(quot;MICR.xlsquot;).Activate
gt; ActiveWorkbook.Close
gt;
gt; In this final 2 lines i wanted a change instead of
gt; ActiveWorkbook.close
gt; i wanted to delete the MICR.xls file which is in C:My Document, i tried
gt; Delete
gt; Any other alternate for this
gt; with regards
gt; nowfal
gt;
gt;
gt; --
gt; nowfal
gt; ------------------------------------------------------------------------
gt; nowfal's Profile:
www.excelforum.com/member.php...oamp;userid=10003
gt; View this thread: www.excelforum.com/showthread...hreadid=526010
gt;
Hi Ardus Petus,
I have tried the quot;killquot; , but the file is still there in my document. I
wanted to delete the file micr.xls for good.
thx and regards
nowfal--
nowfal
------------------------------------------------------------------------
nowfal's Profile: www.excelforum.com/member.php...oamp;userid=10003
View this thread: www.excelforum.com/showthread...hreadid=526010quot;Deletequot; is a VBA Method applied to various Objects within Excel - it will
not delete a file from the disk.
quot;Killquot; 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 quot;Cannot delete . . .quot; 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.)
BrianHquot;nowfalquot; wrote:
gt;
gt; Hi all,
gt; I have the following code
gt; Range(quot;A5,A4quot;).ClearContents
gt; Range(quot;A4quot;).Select
gt; Windows(quot;MICR.xlsquot;).Activate
gt; Range(quot;N2quot;).Select
gt; Windows(quot;MICR PRINT.xlsquot;).Activate
gt; ActiveCell.FormulaR1C1 = quot;=MICR.xls!R2C14quot;
gt; Range(quot;B4quot;).Select
gt; Sheets(quot;DAquot;).Select
gt; Range(quot;A9,A10,A11quot;).ClearContents
gt; Range(quot;A10quot;).Formula = quot;=Spellnumber(A9)quot;
gt; Range(quot;A9quot;).Select
gt; Windows(quot;MICR PRINT.xlsquot;).Activate
gt; ActiveCell.FormulaR1C1 = quot;=MICR.xls!R2C15quot;
gt; Range(quot;A2quot;).Select
gt; Sheets(quot;SAquot;).Select
gt; Range(quot;A9,A10,A11quot;).ClearContents
gt; Range(quot;A10quot;).FormulaR1C1 = quot;=SPELLNUMBER(R[-1]C,quot;quot;INRquot;quot;)quot;
gt; Range(quot;A9quot;).Select
gt; Windows(quot;MICR PRINT.xlsquot;).Activate
gt; ActiveCell.FormulaR1C1 = quot;=MICR.xls!R2C15quot;
gt; Range(quot;A2quot;).Select
gt; Sheets(quot;MICRIquot;).Select
gt; Range(quot;A1quot;).Select
gt; ActiveWorkbook.Save
gt; Windows(quot;MICR.xlsquot;).Activate
gt; ActiveWorkbook.Close
gt;
gt; In this final 2 lines i wanted a change instead of
gt; ActiveWorkbook.close
gt; i wanted to delete the MICR.xls file which is in C:My Document, i tried
gt; .Delete
gt; Any other alternate for this
gt; with regards
gt; nowfal
gt;
gt;
gt; --
gt; nowfal
gt; ------------------------------------------------------------------------
gt; nowfal's Profile: www.excelforum.com/member.php...oamp;userid=10003
gt; View this thread: www.excelforum.com/showthread...hreadid=526010
gt;
gt;
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--
nowfal
------------------------------------------------------------------------
nowfal's Profile: www.excelforum.com/member.php...oamp;userid=10003
View this thread: www.excelforum.com/showthread...hreadid=526010
- Nov 03 Mon 2008 20:47
correction
close
全站熱搜
留言列表
發表留言