CodeExporter

This is an Excel Add-In I created to help with managing projects based around Excel and VBA.

Intro

When using Excel for a VBA project, all code modules are stored within your Excel workbook, making it difficult to use normal revision control methods for the code. I use Hg/Subversion etc for all my other projects, I'd like to be able to use them for Excel projects too.

To get around some of the problems, I wrote this add-in that makes it easy and quick for code modules to be exported from — and imported to — a workbook. I then use version control on the exported files, as well as on the workbook itself. If necessary, I can revert the code modules to a prevision revision, and then import them into the workbook.

From the VBA IDE you can import and export modules fairly easily, it's just very slow and tedious by hand, and experience shows that programmers will never persevere long with tedious tasks. The Add-In provides simple routines to do this quickly. As it does both importing and exporting, it is now badly misnamed.

Features

  • Export or Import all the code modules, including worksheet classes, with as little as two clicks.

    Worksheet class modules are a pain, as you can't import them directly, due to the name clash. To get round this, I manually read the file, delete the existing contents of the module and copy the imported data into the module.
  • Remember where to store/find the modules, either as an absolute path or relative to the workbook path.

Licence

You can download the file for free under the GPL licence. This basically means you may use, modify, and redistribute freely, but if you redistribute it must be under the same terms i.e. the GPL, and you are not allowed to impose further licence terms for the software (e.g. charge royalties, even if you add your own code). Please read the license for more details. It also means there is NO WARRANTY for this software. Use at own risk. Due to the kind of operations being performed, it is quite possible that you could lose data or work, so be careful.

Download

Download codeexporter.xla, release 1.0, zipped, 67 KB

Installation

Put it in C:\Progam Files\Microsoft Office\Office\Library, or equivalent for your system.

Usage

Fairly simple - a toolbar will appear on Excel's main window. Use the 'Export code' or 'Import code' as appropriate.

Bugs/Issues

  • Importing: in order to import correctly, all the existing modules must be deleted first (you're prompted before this happens of course). However, sometimes the deletion doesn't work for some unknown reason, and importing will produce an error. Normally if you try the import again it will succeed.
  • Doing an export/import cycle, just from the VBA IDE, sometimes introduces spurious extra blank lines into a module. An attempt is made to correct this, but it doesn't always work.
  • When the .frx files are exported, it seems they change every time, even if you haven't touched them. This is not a bug in CodeExporter, but Excel.

Feedback

Feedback (or even better, patches) are welcome. E-mail me.

Checksums

Here are the MD5 checksums for the downloaded files.

Release 1.0

644b5c28de94947c663564ad39142355 codeexporter-1.0.zip
f5cc67527ae2489791586af7a2b52d6e codeexporter.xla

Changelog

1.0 - released 20 July 2004

  • Fixed a bug that sometimes occurred when importing empty modules
  • Some trivial changes

0.2

Removed password protection, so people can get at the code

0.1

Initial release