我正在尝试通过 python 中的 pywin32 运行 Excels Solver 加载项:
import win32com.client
from win32com.client import constants as c
app = Dispatch("Excel.Application")
app.Visible = True
app.Workbooks.Open(r'C:\path\to\testsolver.xlsm')
app.Run("runsolver")
..但得到以下错误:
"Cannot run the macro 'runsolver'. The macro may not be available in this workbook or all macros may be disabled"