ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete a file from Excel Application (https://www.excelbanter.com/excel-programming/324659-delete-file-excel-application.html)

Mark

Delete a file from Excel Application
 
My code opens an Excel application (using CreateObject).

From within the Excel application, I'd like to write code to delete a file
(i.e., an Excel workbook) . What is the code to do this?

When I record the macro from the menu: file/open, right click highlighting
the file and left click delete, the file is deleted but the macro is blank.
And Delete does not seem to be a valid method of Workbook.

Any Ideas? Is there some reference that I need to set to allow file
manipulation from within Excel?

Thank you,
Mark



Tom Ogilvy

Delete a file from Excel Application
 
You don't need to open excel to do this.

Kill "C:\Myfolder\MyFile.xls"

should do the job

--
Regards.
Tom Ogilvy

"Mark" wrote in message
...
My code opens an Excel application (using CreateObject).

From within the Excel application, I'd like to write code to delete a file
(i.e., an Excel workbook) . What is the code to do this?

When I record the macro from the menu: file/open, right click highlighting
the file and left click delete, the file is deleted but the macro is

blank.
And Delete does not seem to be a valid method of Workbook.

Any Ideas? Is there some reference that I need to set to allow file
manipulation from within Excel?

Thank you,
Mark






All times are GMT +1. The time now is 01:38 PM.

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