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 O365, be sure your install 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.

Web design by Will Woodgate