Convert the VBA code embedded in the macro-enabled Excel files into plain text files for version control.
[toc]
-
pywin32: to use win32com libraries.
pip install pywin32
-
gooey to use the simple user interface
pip install gooey
Use the .exe file in the "dist" folder.
In the "Excel directory": we have 2 Excel files that we want to "scriptify":
- sample.xlsm
- sample_2.xlsb
After running the program, two folders will be created in the output directory:
- sample
- sample_2
Two .vb files were created in folder "sample":
Mod1.vb: this is extracted from the module "Mod1" in the sample.xlsm
Sub test_macro_1()
' this is some comments
MsgBox "hello world"
End Sub
Sub test_macro_2()
' this is another macro
MsgBox "this is just another piece of coding"
End Sub
Sheet1.vb: this is extracted from the worksheet "sheet1" in the sample.xlsm
Sub test()
'this is a macro in the worksheet
MsgBox "this is called from the worksheet"
End Sub