With a little patience, you can manage to give it variable arguments. If you need only to run a Python script from you application that will return nothing, you might have a solution from XLWings, which offers a directive RunPython. Is it that they just don't want us to do so ("defective by design")? Or it's an obscure side-effect of a Microsoft-Apple trade war? Or Microsoft's "corporate brain" is not aware at all that there is an issue? Whatever the case may be, they are not telling us. I am not sure what people at Microsoft have been thinking, when they expected us to go through all the loops of installing an AppleScript file in an obscure directory just to have the privilege of running. Hence it's not sufficient for us to learn VBA and Python, now we are also supposed to learn AppleScript and the intricacies of MacOS. So far, the state of the art seems to be: "just look over there and good luck".
I couldn't find much indication on how we are supposed to do that, except some helpful hints by Ron de Bruin. The general idea is that you have to create a AppleScript script in ~/Library/Application Scripts//, that will launch, somehow, your python program with the correct parameters. Instead, we are supposed to use the AppleScriptTask directive. In Office 2016, MacScript has been deprecated, because of "sandboxing".
#HOW TO LAUNCH VBA IN EXCEL 2016 HOW TO#
Basically, how to create a function that will "jailbreak" out of Excel.īut here is how far I got: MacScript was a solution that allowed you, in Office 2011, to use a thin AppleScript wrapper to run anything. I am myself looking for an answer on how to get Excel VBA on MacOS to run anything that is not VBA.
#HOW TO LAUNCH VBA IN EXCEL 2016 FOR MAC#
Is there something to be modified/added for Excel for Mac 2016? Library/Frameworks/amework/Versions/3.5/bin/python3 ScriptToRun = scriptToRun & "end tell" & Chr(13) ScriptToRun = scriptToRun & "set appUserPath to POSIX path of " & """" & macPath & """" & Chr(13) ScriptToRun = "tell application ""Finder""" & Chr(13) If you want to get the output from the command,Ĭommand = "cd " & myDir & " & " & python3Dir & " myPythonScript.py #"įunction getPosixPath(macPath As String) As String Private Declare Function system Lib "libc.dylib" (ByVal command As String) As LongĬonst python3Dir As String = "/usr/local/bin/python3" Nothing happens on Excel for Mac 2016, i.e. When I run the following and pass some parameters to my existing Python script from Excel for Mac 2011 it works.