0

I have the following VBA Script

Dim fileName As String
fileName = MacScript("choose file name")
MsgBox fileName

✅ If I run the AppleScript in Script Editor, and select a pre-existing file, a path is returned.
✅ If I run the AppleScript in Script Editor, and attempt to create a new file, a path is returned.
✅ If I run this in Excel, and select a pre-existing file, a path is returned.
❌ If I run this in Excel, and attempt to create a new file, a path is NOT returned.

What could be going wrong please?

Mac Version: 10.14 (Mojave)
Excel Version: 16.20 (181208)
VBA Version: 7.1

4
  • Wild guess - System Prefs>Security & Privacy>Privacy - look at Full Disk Access & Automation perms – Tetsujin Jan 15 '19 at 12:06
  • It sounded like a good guess, but unfortunately it doesn't seem to have made a difference. – James Webster Jan 15 '19 at 12:17
  • Do you mean perhaps MacScript("ChooseFile")? Do you get any errors currently? Can VBA access the script choose file name? Does this page help? – BruceWayne Jan 15 '19 at 17:10
  • @BruceWayne. Thanks for your reply. choose file only allows the selection of pre-existing files. I'd like to be able to create a new file. I assume VBA can access the script because it runs. And the script you link to is even more restrictive, it allows the user to select a folder only. – James Webster Jan 16 '19 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.