Python Forum

Full Version: No output from xlwings RunPython Macro
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am attempting to use a basic example of xlwings. I have the following VBA script:

Sub Test()
RunPython ("import VBAtester; VBAtester.test()")
MsgBox ("Script has run.")
End Sub

Which is in the same directory as the python script VBAtester.py:

import xlwings as xw

def test():
wb = xw.Book.caller()
wb.sheets[0].range('A1').value = 'TEST VALUE'

The VBA script runs and outputs the message box; but *'TEST VALUE'* does not show in cell A1, or elsewhere. I know the python script is being called as if I purposefully put errors in my python script VBA will callback these errors when I run the VBA script that calls the python script.

From the documentation, http://docs.xlwings.org/en/stable/quickstart.html, I do not see my error.

What is the error in my understanding or my approach?