I started learning VBA in MS Word yesterday. I have some programming experience in C++ and Java. I am trying to understand how the environment is structured and what Projects, Objects and Modules represent.
For example I recorded a few macros using the macro recorder and then opened the VB Editor to see what was created. I notice that under "Project" are 3 folders. One is named "Microsoft Word Objects". Within this folder is what looks like a file named "This Document". What does "Project" represent What does "This Document" represent What is the difference between "This Document" and the "Project"
Also under "Project" is a folder named "Modules". Within this folder is what looks like a file named "New Macros". This "file" seems to hold the code that represents the macros I recorded. Right clicking on the "Modules" folder allows me to insert another module into which I can add code for a Sub/s (short for subroutine/s I assume) via the VB Editor to do whatever.
Why would you put code for different Subs into different modules The simple tutorials I have been studying seem to put all Subs into the one module. Why is the code for the recorded macros put into a separate module
I am trying to work out exactly what Projects, Objects, and Modules
are and how they interact. It seems like some sort of hierarchy. This
environment is very new and quite confusing to me at the moment. Any
help or references appreciated.