Excel 365 MacOS: Creating a .scpt file in application scripts folder

oatmeal

New Member
Joined
Jan 9, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello!
I wanted to see if there was a way to Use VBA to create a .scpt file in the application scripts folder ("/Users/ComputerName/Library/Application Scripts/com.microsoft.Excel") on MacOS? I am able to read files from that folder using
myfile = "/Users/" & Environ("USER") & "/Library/Application Scripts/com.microsoft.Excel/test.scpt"
str = ""
Open myfile For Input As #1
Do Until EOF(1)
Line Input #1, textline
str = str & textline
Loop
Close #1
However I am unable to create a new scpt file using
strFile = "/Users/" & Environ("USER") & "/Library/Application Scripts/com.microsoft.Excel/test.scpt"
Open strFile For Output As #1
Print #1, "on ShellEx(shellCmd)" & vbNewLine & vbTab & "do shell script shellCmd end ShellEx"
Close #1
I run into an error saying "Run-time error '75': Path/File access error".

I know that this might stem from sandboxing on MacOS and that a user needs to grant permission to access that folder. Is there any way to create files in that folder without the user having to do anything? Any help is appreciated. Thank you!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,223,885
Messages
6,175,181
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top