I used to use the info in this question to run a VBA script that does some basic formatting after I run my python code.
How do I call an Excel macro from Python using xlwings?
Specifically I used the first update.
from xlwings import Workbook, Application
wb = Workbook(...)
<xlwings.main.Macro at 0x92d3198>
import xlwings as xw
xlfile = 'model.xlsm'
wb = xw.Book(xlfile)
<xlwings.main.Macro at 0x92d05888>
You need to use
Book.macro. As your link to the docs says,
App.macro is only for macros that are not part of a workbook (i.e. addins). So use:
your_macro = wb.macro('your_macro') # this maps the VBA code your_macro() # only this executes the VBA code