Under windows10, I'm running a python code via VScode and it works but when I try the same python code from VBA, It stopped at 'import xlwings' Anyboy can help me out?
VBA code in text.xlsm:
Dim objShell As Object
Dim pythonExe, pythonScript As String
Set objShell = VBA.CreateObject("wscript.Shell")
pythonExe = """C:\Program Files\Python39\python.exe"""
pythonScript = "E:\python\codes\run_thiscode.py"
objShell.Run pythonExe & pythonScript
End Sub
python code in the same folder:
from selenium import webdriver
print('... some codes ...')
import xlwings as xw
import pandas as pd
print('... and some other codes....')
Again, the python code works fine when I run it via VScode. but it won't work through VBA
Traceback (most recent call last):
File "E:\python\codes\0_cmpcmpia\run_thiscode.py", line 36, in <module>
browser, handle, info = cmp.dashb(browser, handle, info)
File "E:\python\codes\0_cmpcmpia\cmp.py", line 222, in dashb
import xlwings as xw
''''''''
ImportError: No system module 'pywintypes' (pywintypes39.dll)