ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Kill Command (https://www.excelbanter.com/excel-programming/289701-kill-command.html)

JamieD[_3_]

Kill Command
 
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



--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Kill Command
 
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)

"JamieD " wrote in message
...
Hi all,
Very quick one for you,
Any body able to tell me why the below doesn't work. If I run the Kill
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

J


---
Message posted from http://www.ExcelForum.com/




Alan Hutchins

Kill Command
 
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
-----Original Message-----
Hi all,
Very quick one for you,
Any body able to tell me why the below doesn't work. If I

run the Kill
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

J


---
Message posted from http://www.ExcelForum.com/

.


Tom Ogilvy

Kill Command
 
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.

--
Regards,
Tom Ogilvy

"JamieD " wrote in message
...
Hi all,
Very quick one for you,
Any body able to tell me why the below doesn't work. If I run the Kill
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

J


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 12:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com