Kill Command

J

JamieD

Hi all,
Very quick one for you,
Any body able to tell me why the below doesn't work. If I run the Kil
line by itself then its fine.

Windows("Collection Note.xls").Activate
ActiveWindow.Close
Kill "G:\EXCELDOC\Returns Check\Collection Note.xls"

Hope someone can help/

Many Thanks
 
B

Bob Phillips

Jamie,

If this code is in "Collection Notes.xls", by closing that window you will
stop the execution of the code, before the Kill can operate.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
A

Alan Hutchins

Not sure why, think it is because Excel might remember the
workbook name, but have experienced this myself.

Would suggest that the active window.close statement, you
activate another workbook so Excel has that as the live
name in it's memory, and then try to kill the other wb.

HTH
 
T

Tom Ogilvy

Is the code in the workbook "Collection Note.xls" ?

If so, once you close it (which you do in the second line) the code stops
executing.
 
Top