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!
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!