ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to delete a workbook. (https://www.excelbanter.com/excel-programming/283913-macro-delete-workbook.html)

John Baker

Macro to delete a workbook.
 
Hi:

I need to save some data in a special workbook, save the workbook (with a new name), then
e mail the workbook and delete the saved workbook.

I can do all this except the last step.

I want to delete the saved workbook (which is not the one containing the macro) with no
question or message to the end user.

Anyone know of a method?

Regards

John Baker

Chip Pearson[_2_]

Macro to delete a workbook.
 
John,

You can use the Kill statement to permanently delete a file. For
example,

Kill "C:\Test\Book1.xls"

Note that Kill does not put the file in the Recycle Bin. To
delete a file to the Recycle Bin, see
www.cpearson.com/excel/recycle.htm .


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"John Baker" wrote in message
...
Hi:

I need to save some data in a special workbook, save the

workbook (with a new name), then
e mail the workbook and delete the saved workbook.

I can do all this except the last step.

I want to delete the saved workbook (which is not the one

containing the macro) with no
question or message to the end user.

Anyone know of a method?

Regards

John Baker




John Baker

Macro to delete a workbook.
 
Chip:

Thanks..works like a charm!

John

MSP77079

Macro to delete a workbook.
 

Command to delete a file is:

Kill ThisFileName

where ThisFileName is the complete path

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com



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

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