tags:

views:

570

answers:

4

My understanding of VBA is that one office document contains a suite of VBA functions, all stored within the same file as the data.

Is it possible to have more than one developer modify this code at once?

In a conventional software development project, the code is distributed amongst multiple text files. Developers can modify and check in separate files. In the instance where two developers modify the same file, the source control system will provide merge functionality to deal with any conflicts.

On the surface, I would assume that this concept can not apply with a VBA application. It can not apply because all of the code is stored in one file, and this file is in a proprietary binary format, so any third party merge tools cannot read it. (Please correct me if I'm wrong on that)

Does Microsoft Office provide any sort of merge facility for VBA?

+3  A: 

There is a Source Safe addin for VBA which you can read about here:

VBA Source Code Control Add-In

If you are using some other source control system (Git, Mercurial etc..) I suggest the following:

When I was doing a lot of Excel VBA development. I got into the habit of exporting to the text format for each file (module, etc) each time I made a change (from the context menu). This worked pretty well for me and didn't require any external tools (there are external tools or script based solutions to exporting your code, but I prefer this approach).

Cannonade
Does Office provide a straightforward way to import this back into the module?
Andrew Shepherd
There is an import and an export item on the context menu. So when I needed to merge changes from SCC, I would import from the SCC file.
Cannonade
A: 

There's a conventional design pattern for VBA (useful in both excel and access) that lets you store modules (most especially including classes) in discrete files in a fashion that is compatible with pretty much any scc package.

le dorfier
Not sure what you mean by "conventional design pattern for VBA"? I am Wondering how it works. Thanks :).
Cannonade
Same answer as you gave. You end up importing and exporting the modules/classes.
le dorfier
+4  A: 

There's a (free) VBA editor add-in called VBA Code Cleaner that will export (and re-import) all your modules/class/forms. It works fine.

I discussed some aspects of automatically exporting on Save/Close. I haven't yet got around to the automatic import from an updated repository though...

Mike Woodhouse
A: 

Answered the same thing in another topic. Another alternative for you to try.

http://stackoverflow.com/questions/608872/exporting-vba-code-from-multiple-excel-documents-to-put-into-version-control/1453989#1453989

(is there a way to cross-link these topics and/or answers?)

Vijay