Python VBA提取以获取宏箱 [英] Python vba extract to get bin of macro

查看:62
本文介绍了Python VBA提取以获取宏箱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用python将vba_project添加到工作簿的"Sheet1"中.

I am trying to add a vba_project to "Sheet1" of a workbook using python.

我正在跟踪 XLSXWRITER文档,以便从其他工作表中获取VBA代码的bin.我想在新工作簿的"Sheet1"中使用它.

I am following XLSXWRITER documentation to get the bin of the VBA code from a different sheet which I would want to use in "Sheet1" of my new workbook.

我在命令提示符下输入以下代码,但收到错误消息:'vba_extract.py'无法识别为内部或外部命令"

I enter the below code in command prompt but I get the error: "'vba_extract.py' is not recognized as an internal or external command"

$ vba_extract.py Book1.xlsm
Extracted: vbaProject.bin

有人可以逐步介绍如何从旧文件中提取宏作为bin,然后使用python输入到新工作簿的sheet1中吗?

Can someone give me a step by step on how to extract the macro from old file as bin and then input into sheet1 of new workbook using python?

推荐答案

您必须告诉cmd您正在运行python文件.

You have to tell the cmd you're running a python file.

尝试此批处理代码:

cd C:\path\of\yourfile.py
python vba_extract.py Book1.xlsm

添加了cd命令,您必须位于python文件的文件夹中.

edit: Added cd command, you have to be in the folder of the python file.

这篇关于Python VBA提取以获取宏箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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