Delete Files on Mac

Note : When you use VBA in Mac Excel 2016 or higher that is working with files and folders you will notice that it is possible that it will ask you permission to access the file or folder (Grant File Access Prompt), this is because of Apple’s sandbox requirements.This means that when you want to save/open files or check if it exists with VBA code the first time you will be prompted to allow access on the first attempt to access such a folder or file. If you want to avoid problems like this read this page : Problems with Apple’s sandbox requirements

Note: The code examples with wildcards below are working in 2019 and higher and Microsoft 365, be sure your have installed the latest updates.

Note: You should also note the use of wildcard character (*) in the macro. You can use it to search for all files of a specific type: *.pdf only for PDF files or *.docx to delete only Microsoft Word docx files.

11/11/2024
Web design by Will Woodgate