QUOTE (PeteBryden @ Dec 1 2011, 07:00 AM)
I'll have a look for the compile button next time I'm tweaking some code!
Office VBA has a "feature" that allows us to run the code without explicitly compiling it first. In my opinion, they should have left this out. When you write code, there's a number of different layers to your code... the plaintext version you see on your screen, cached copies of that, copies of that converted to something readable by the machine, etc etc etc.
When you write code, VBA automatically updates *some* of this, thus allowing the code to be run seemingly without compiling. At this point there's conflicting versions of the code, which is ok in theory (VBA sorts it out), but leaves a lot of room for error. Compiling through the menu command (or ribbon command on '07 I suppose?) syncs these different versions and smooths out any differences.
You may notice sometimes that if you're debugging and stepping through the code, and you change a thing or two in debug mode (which is techincally allowed), when you exit debug mode those changes are lost. This is the same principle: when in debug mode it keeps seperate copies of your code; one to run, one to edit, etc, but sometimes gets confused. The solution there: don't edit in debug mode.