Copy File or files with VBA in Mac Excel

: 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: I have also examples to copy a file or folder on this page but that is not so easy to setup but if you want to know more visit this page: How to use AppleScriptTask in Mac Office

In Excel for Windows we have more ways to copy files but on the Mac FSO is not working for example:
Set FSO = CreateObject("scripting.filesystemobject")

VBA FileCopy and Name

But we can use VBA FileCopy and Name in Mac Office to copy files like this :

If you have for example a list like this in a worksheet with in B the file path and in C the file name that you want to copy and in D the new file name you can try the example below to make it easy to copy more files.


VBA SaveCopyAs

If you want to make a copy/backup of the ActiveWorkbook you can also use SaveCopyAs but this is only working if the file is open.
Web design by Will Woodgate