The VBA Editor - Backup
- 01:25
Understand how to export and import Macro modules
Downloads
No associated resources to download.
Glossary
.bas File TypeTranscript
So, sometimes it's useful to be able to back up your macros so that you can keep them if you have a potential problem with your laptop or your computer, or, of course, if you want to send the code to somebody else. So, it's very simple to do. You just select the module that you'd like to back up. Then go to the File menu and choose Export File. And you'll notice the file type is a bas file, .bas.
Give it a file name. The default will be the name of the module. Click on Save. And we've now exported all of the modules, so whatever macros were inside of this module out to a file. If we want to import a file. Let's say that in the Personal macro workbook here I don't have any modules but I'd like to import one that somebody has sent me or that I've backed up previously. Then I would go to File, Import File, choose the file that I'd like to import, click on Open, and now we'll see a module appear and I'll be able to access the macro in that module. So, that's how we go about backing up and then restoring modules that contain macros.