Ich habe ein VBA-Skript wie unten angegeben, das ein Python-Skript ausführt, das Werte in Excel-Arbeitsmappen schreibt.Excel VBA-Shell-Skript, das Python-Skript nicht funktioniert
import xlrd
from xlutils.copy import copy
rb = xlrd.open_workbook("https://stackoverflow.com/a/b/StubProto.xlsm")
wb = copy(rb)
ws1 = wb.get_sheet(0)
ws1.write(1, 11, "Hello World")
wb.save("StubProto.xlsm")
Der obige Code funktioniert OK auf seinem eigenen in einer Windows-Umgebung, aber funktioniert nicht auf einer VBA-Umgebung:
Dim args
Dim Ret_Val
args = ActiveWorkbook.Path & "\helloWorld.py"
Ret_Val = Shell("C:\Python27\python.exe " & args, vbNormalFocus)
Die helloWorld.py ist unten angegeben. Es scheint nichts in einer VBA-Umgebung zurückzugeben.
Gibt es etwas, was ich falsch mache?