No output from xlwings RunPython Macro

branches

New Member
Joined
Oct 29, 2017
Messages
1
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?
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,214,982
Messages
6,122,573
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top