You can export code modules to text files. In the VBA editor,
select the module you wish to export, then go to the file menu,
choose Export, and enter a file name. But since macros are
always stored in workbooks, the simplest way is to just make a
copy of the workbook to a safe location.