在 python 中使用 excel 插件的问题
我正在尝试使用 python 和 win32com 将 excel 工作簿加载到我打开的 excel 实例中,该实例具有活动的插件
我用来打开文件的代码是这样的。
excel=win32com.client.Dispatch("Excel.Application")
source = excel.Workbooks.Open('test.xlsm')
问题是,这实际上是在没有激活插件的情况下打开一个单独的 Excel 实例。
我尝试打开该插件文件,然后打开工作簿,如下所示。
excel=win32com.client.Dispatch("Excel.Application")
addin = excel.Workbooks.Open('addin.xla')
source = excel.Workbooks.Open('test.xlsm')
但是当我尝试使用插件时,我收到与此类似的错误。
无法运行宏“sbex.xla!runQuery”
任何想法都会有帮助。
I am trying to use python and win32com to load an excel workbook into an instance of excel that I had opened that has an addin active
The code I'm using to open the file is this.
excel=win32com.client.Dispatch("Excel.Application")
source = excel.Workbooks.Open('test.xlsm')
The problem is that this is actually opening a separate instance of excel without the addin active.
I have tried opening that addin file and then the workbook like this.
excel=win32com.client.Dispatch("Excel.Application")
addin = excel.Workbooks.Open('addin.xla')
source = excel.Workbooks.Open('test.xlsm')
but when I try and use the addin I get an error similar to this.
Can't run macro "sbex.xla!runQuery"
Any ideas would be helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论