如何通过选择列A直到数据存在来运行宏
我正在尝试从 python
和 win32com.client
运行宏。当我手动尝试时,我的宏工作正常,因为它必须通过选择 A 列和行来运行,直到数据存在。 宏具有文本列功能和创建标题。
但是当我尝试从代码中它没有按预期工作。
import win32com.client as wincl
excel_app = wincl.DispatchEx("Excel.application")
excel_workbook = excel_app.Workbooks.Open(Filename=temp_macro_template_file_path, ReadOnly=1)
excel_app.Visible = True
excel_app.Columns('A')
excel_app.Application.Run("Macroname")
excel_workbook.Save()
excel_app.Application.Quit()
这就是我在这之后得到的。
I am trying to run a macro from python
and win32com.client
. My macro is working fine when i am trying manually, Because it has to run by selecting column A and rows till data exists.
Macro has Text column functionality and creating headings as well.
But when i try from code it is not working as expected.
import win32com.client as wincl
excel_app = wincl.DispatchEx("Excel.application")
excel_workbook = excel_app.Workbooks.Open(Filename=temp_macro_template_file_path, ReadOnly=1)
excel_app.Visible = True
excel_app.Columns('A')
excel_app.Application.Run("Macroname")
excel_workbook.Save()
excel_app.Application.Quit()
This is what i am getting after this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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