#1
|
|||
|
|||
Need help deleting some specific files by an Excel macro
I am trying to delete some specific PowerPoint files which are in a specific folder through following macro. But when running the code, it gives this error”File not found” on the line “Kill MyFiles”. As the attachment shows, the PowerPoint files are in the mentioned folder and by utilizing a MsgBox and clicking on the line which the error occurs, I have ensured that the code identifies the files but, for a unknown reason, it fails to delete them. Can you give me some guides on this issue?
Option Explicit Sub deletepowepoint() Dim MyFiles As String MyFiles = Dir("D:\kalantari\miscellaneous\dailyreport01\*.pp tx") Do While MyFiles <> "sample.pptx" Kill MyFiles MyFiles = Dir Loop End Sub Last edited by soroush.kalantari; 08-20-2022 at 06:54 PM. |
Tags |
delete files |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word macro for deleting a line that starts with a specific character + deleting the line before | eduardb | Word | 1 | 08-10-2022 03:17 AM |
Excel Macro finding a specific word | ducky831 | Excel Programming | 3 | 09-17-2015 01:36 PM |
Excel VBA Macro - Deleting Specific Data based on criteria | MD011 | Excel Programming | 3 | 12-10-2014 02:15 AM |
Macro to copy specific columns in Excel from another spreadsheet | KD999 | Excel Programming | 1 | 07-20-2012 08:58 AM |
excel 2010 not deleting tmp files on save/close | willbaker13 | Excel | 0 | 04-26-2012 05:08 PM |