Ariel Ariel - 1 day ago 4
Python Question

Python vba extract to get bin of macro

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

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.

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


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?

Answer

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

Try this batch code:

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

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

Comments