ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete workbook (https://www.excelbanter.com/excel-programming/429595-delete-workbook.html)

Ed[_30_]

Delete workbook
 
I have a macro which has copied data from a workbook, I now want the macro
to delete the entire workbook (send it to the recycle bin) but can't figure
out how to do it. Can someone please help me with this problem.



Patrick Molloy

Delete workbook
 
KILL "path"

"Ed" wrote in message
...
I have a macro which has copied data from a workbook, I now want the macro
to delete the entire workbook (send it to the recycle bin) but can't
figure out how to do it. Can someone please help me with this problem.


Rick Rothstein

Delete workbook
 
Just so the OP knows, Kill doesn't send the file to the Recycle Bin (as the
OP indicated he wanted)... it permanently removes the file from the drive.

--
Rick (MVP - Excel)


"Patrick Molloy" wrote in message
...
KILL "path"

"Ed" wrote in message
...
I have a macro which has copied data from a workbook, I now want the
macro to delete the entire workbook (send it to the recycle bin) but
can't figure out how to do it. Can someone please help me with this
problem.



Rick Rothstein

Delete workbook
 
If the OP wants to use the Recycle Bin, there is an API solution to do so.
There is an example of how to do this here...

http://vbnet.mvps.org/code/shell/recyclebin.htm

If the OP needs help breaking this apart for his own needs, he should post
back to this thread and someone here will assist him.

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
Just so the OP knows, Kill doesn't send the file to the Recycle Bin (as
the OP indicated he wanted)... it permanently removes the file from the
drive.

--
Rick (MVP - Excel)


"Patrick Molloy" wrote in message
...
KILL "path"

"Ed" wrote in message
...
I have a macro which has copied data from a workbook, I now want the
macro to delete the entire workbook (send it to the recycle bin) but
can't figure out how to do it. Can someone please help me with this
problem.




Ed[_30_]

Delete workbook
 
Thanks Patrick, it works great.


"Patrick Molloy" wrote in message
...
KILL "path"

"Ed" wrote in message
...
I have a macro which has copied data from a workbook, I now want the
macro to delete the entire workbook (send it to the recycle bin) but
can't figure out how to do it. Can someone please help me with this
problem.




Ed[_30_]

Delete workbook
 
Thanks Guys - I don't really care what happens to the file. Appreciate all
your help - working fine.


"Rick Rothstein" wrote in message
...
If the OP wants to use the Recycle Bin, there is an API solution to do so.
There is an example of how to do this here...

http://vbnet.mvps.org/code/shell/recyclebin.htm

If the OP needs help breaking this apart for his own needs, he should post
back to this thread and someone here will assist him.

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
Just so the OP knows, Kill doesn't send the file to the Recycle Bin (as
the OP indicated he wanted)... it permanently removes the file from the
drive.

--
Rick (MVP - Excel)


"Patrick Molloy" wrote in message
...
KILL "path"

"Ed" wrote in message
...
I have a macro which has copied data from a workbook, I now want the
macro to delete the entire workbook (send it to the recycle bin) but
can't figure out how to do it. Can someone please help me with this
problem.







All times are GMT +1. The time now is 12:31 AM.

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