Python Forum
No output from xlwings RunPython Macro
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
No output from xlwings RunPython Macro
#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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  xlwings error when reading a workbook Mishal0488 1 1,109 Aug-01-2023, 02:05 AM
Last Post: deanhystad
  Help using a dynamic array excel formula with XLWings FXMonkey 2 1,291 Jun-06-2023, 09:46 PM
Last Post: FXMonkey
Question convert autohotkey script to python / macro - press key when pixel get colour willson94d 1 3,650 Jan-01-2022, 08:13 PM
Last Post: Yoriz
  Auto-populate Macro variables Spartan314 3 2,661 Mar-08-2021, 12:36 AM
Last Post: Spartan314
  How do I reduce the time to Invoke Macro via Python? JaneTan 1 2,132 Dec-28-2020, 06:46 AM
Last Post: buran
  Hi Guys, please help me to write SAS macro parameter equivalent code in Python Manohar9589 2 2,593 Jun-14-2020, 05:07 PM
Last Post: Larz60+
  xlwings UDF showing name error pwt 9 5,002 May-29-2020, 07:09 AM
Last Post: pwt
  Jython macro which uses PythonInterpreter and Redis script gives an error rkanumola 2 2,246 Oct-30-2019, 07:37 AM
Last Post: rkanumola
  run an excel macro with python mmolet 1 9,027 Apr-02-2019, 09:36 AM
Last Post: Vinci141
  SAS Equivalent of Macro variable in Python AI_ML_Neophyte 4 11,643 Mar-29-2019, 08:14 AM
Last Post: FelixS

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020