Instead of having the VBA code saved in a module inside the Excel file, I would like to have the code saved in a text file, for example module1.vba
. In Excel, module1.vba
would be loaded or imported and run as it was a normal module.
Is that possible? How to do that?
In Excel, in the VBA editor, there is the option Insert > File...
in the menu that does sort of what I want, but I don't know how to automate that with a minimal VBA code to load the real code saved as text.
Reason for this is to allow code revision control using text based applications like git
.
--- edit ---
This answer shows a good alternative work around. However I'm still not too happy in duplicating things.