Import external
.bas,.clsand.frmfiles to an Excel workbook.
Using the vba_excel_export_code script, it's possible to export all codes from an Excel workbooks to files so it becomes easy to store code in versioning system like github.
This script will do the opposite: load external files to an Excel workbook. You can manipulate your codebase outside Excel (outside the old VBE editor), apply tools like prettiers, ... and import files back in Excel, for instance.
Just get a copy of the .vbs script, perhaps the .cmd too (for your easiness) and save them in the same folder of your Excel application (containing the code you want to export).
Just edit the .cmd file and you'll see how it works: you just need to run the .vbs with one parameter, the name of the folder where your codebase is saved. Or, with a second parameter, the name of the file where code has to be imported.
This script will ask up to two parameters:
- The folder where your codebase is saved
- An optional existing workbook filename where code will be imported.
Imagine you've your codebase saved in the c:\repository\my_application\src. There, you've .bas, .cls and/or .frm files that were generated by the vba_excel_export_code script.
To import them in a new Excel workbook just run this script like this:
cscript run.vbs c:\repository\my_application\srcBy giving only one parameter, the source folder, a new, empty, Excel workbook will be created and files from c:\repository\my_application\src will be imported one by one.
You can specify a filename as a second parameter like below:
cscript run.vbs c:\repository\my_application\src app.xlsmHere, the script will open the app.xlsm workbook (need to exists on disk) and import codebase it that file.
Christophe Avonture
PRs not accepted.
