GetSaveAsFileName on a Mac
The macro below will use the built-in GetSaveAsFileName in Mac Excel, and you see that the only parameter that is working is InitialFileName. There are a few nice parameters that you can use with GetSaveAsFileName that all work correct in Windows but not on the Mac, FileFilter is a very important one that is not working on a Mac. Also ChDir is not working on the Mac to open the GetSaveAsFileName dialog in the folder you want. Check out the second example on this page for another way to get almost the same result.
Use the AppleScriptTask function to get almost the same result
With the AppleScriptTask method you need to distribute an extra file containing the script, and it must be placed in the specified location on the user’s system to have permission to run. This requires some user interaction the first time.
I create this install script for you to copy the script file in the correct location, you can download the Install.scpt script together with the GetSaveAsFileName.scpt file below. The folder must be in the Users Download folder, you see that if you download the compressed folder from my website it will automatically uncompressed in your Downloads folder and you can double-click the Install.scpt file in it to Open and Run it to copy the GetSaveAsFileName.scpt in the correct location so the AppleScriptTask function can find it.
You can download the Install.scpt and GetSaveAsFileName.scpt files below (File dates 11-Dec-24)
Download Files
I create this install script for you to copy the script file in the correct location, you can download the Install.scpt script together with the GetSaveAsFileName.scpt file below. The folder must be in the Users Download folder, you see that if you download the compressed folder from my website it will automatically uncompressed in your Downloads folder and you can double-click the Install.scpt file in it to Open and Run it to copy the GetSaveAsFileName.scpt in the correct location so the AppleScriptTask function can find it.
You can download the Install.scpt and GetSaveAsFileName.scpt files below (File dates 11-Dec-24)
Download Files
If you only want to let the user save the file as xlsm for example on the Mac. We can use the custom code below to let the user browse to a location(you can set the Start folder) and enter a file name. We can now use the result(path/filename) in the code to really save the file, the script also check if the file already exists in the location you choose. The basic example code below is something that is close to what you can do in Excel for Windows, but if you have suggestions please let me know.
Below you find two macro's that call the AppleScriptTaskFile, the first one you not have to change before you run it and opens on the Desktop. You can use Both macro's to get the file path. See the commented code lines in the macro that show you how to save the ActiveWorkbook in the format you want after you test the code.
Below you find two macro's that call the AppleScriptTaskFile, the first one you not have to change before you run it and opens on the Desktop. You can use Both macro's to get the file path. See the commented code lines in the macro that show you how to save the ActiveWorkbook in the format you want after you test the code.