PDA

View Full Version : How does Module1 differ from NewMacros?



EricFletcher
08-27-2004, 07:54 AM
I've been creating and using Word macros for years. However, I've never bothered to figure out what was going on within the VBE window -- other than noting that macros I record (or VBA that I paste in when I choose Create from the Macros dialog) get added to the growing set of code.

I do note that the area such macros get dropped into is named "NewMacros" within the Project area. Instructions in the KB typically seem to have users insert a module -- which typically becomes Module1 -- but why is this different than just adding the code to NewMacros (as seems to be done by default when recording a macro)?

Perhaps somebody out there can provide a succinct answer about this for those of us who are reasonably comfortable with the macro part but not with the structural aspects of VBA.

TonyJollans
08-27-2004, 08:51 AM
Hi Eric,

Welcome to VBAX!

There is absolutely no difference at all between NewMacros and Module1 or any other standard module. They both act as containers, allowing you to organise your procedures to suit yourself. As far as Word is concerned all the procedures in all the modules are considered equal. One point to note, perhaps, is that complete references to procedures include both the procedure name and the module name and it is possible, therefore, to have two procedures with the same (unqualified) name if they are in different modules. The only other point of any sort at all is the one you have identified: Word drops all its recorded code into NewMacros ? it?s got to put them somewhere and that?s where it chooses - this is of no more significance than the fact that the recorded macros are named Macro1, Macro2, etc - they've got to have names and that is what Word chooses.