使用Python编写MS Office宏? [英] Using Python to program MS Office macros?

查看:582
本文介绍了使用Python编写MS Office宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近把它作为一个项目来教自己如何用Python编程。总的来说,我必须说,我印象深刻。



过去我通常坚持在VBA中编程,主要用于MS Excel(但也有一点MS Access和Word),并努力寻找方法,使Python可以轻松地完成一个命令。



我想知道是否有合理的方式利用Python的编程能力和易用性,同时利用Office(大部分是Excel)中的各种工具?

解决方案

p>有一组跨平台的Python工具,称为xlrd,xlwt和xlutils,用于阅读&编写Excel文件。有一些限制(例如,我不认为他们可以处理宏),但是它们允许您在非Windows平台上使用Excel文件,如果这对您有用。请参阅: http://www.python-excel.org/



此外,还有一些问题已经在处理这类主题,包括:
是否有更好的方法(除了COM)远程控制Excel?


I've recently taken it as a project to teach myself how to program in Python. Overall, I must say that I'm impressed with it.

In the past I've typically stuck to programming in VBA mostly for MS Excel (but also a bit in MS Access and Word) and have struggled to find ways to make it do things that Python can easily do with a single command.

I was wondering if there were a reasonable way to harness the programming power and ease of Python while at the same time make use of the various tools in Office (mostly Excel)?

解决方案

There is a set of cross platform Python utilities - called xlrd, xlwt, and xlutils - for reading & writing Excel files. There are some limitations (e.g. I don't think they can process macros), but they do allow you to work with Excel files on non-Windows platforms, if that's of use to you. See: http://www.python-excel.org/

Also, there are SO questions already dealing with this sort of topic, including this: Is there a better way (besides COM) to remote-control Excel?

这篇关于使用Python编写MS Office宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆