excel - Run and execute a python script from VBA -


i'm trying run python script vba module. i've tried pretty every example i've seen on internet , have had no luck. in vba module run .bat file, , works perfectly:

batchname = "u:\backup bat file.bat"  shell batchname, vbnormalfocus 

next need run python script, located in same folder excel file. right i'm trying out this:

dim ret_val  dim args  args=activeworkbook.path & "\beps_output.py"  ret_val = shell("c:\python34\python.exe" & args, vbnormalfocus) 

it doesn't error out, nothing happens. i'm little confused @ "ret_val" (return value?) here, , why isn't running.

try adding space between exe program , file:

ret_val = shell("c:\python34\python.exe " & args, vbnormalfocus) 

also, because shell function returns value (variant type - double) specified arguments, returned value can contained in variable, here specify ret_val. can add conditional logic , error handling using value.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -