The images in this section are all from Outlook 2016 but they could have come from Outlook 2003. Outlook VBA may have changed over the years but to my eyes the VBA Editor has not. Whichever version you have you will see something like:
Above there is a “+” against "Project1". If you have a “+” click it and then the “+” against "Microsoft Outlook Objects" to get:
The Properties window may not be present or, if present, may be positioned elsewhere within the VB Editor window. We do not need it for the moment. You can close it by clicked the cross and can use F4 to make it visible again at any time. I do not normally have it visible because I do not need access to Properties most of the time and my Project Explorer list occupies most of the left side. I suggest you keep it visible until it becomes a nuisance.
If you click ThisOutlookSession, either the grey area will turn white or, as in the image below, a code window will appear within the grey area:
You can type any code into this code window. However, event routines (which are discussed towards the end of this tutorial) must be typed into this code window. I recommend you reserve the ThisOutlookSession code area for event routines.
Instead, click Insert to get:
Click on Module to add a module:
My new module is named “Module1”. If your version of Outlook is a non-English version, your module will have an equivalent name in your language. You can add more modules which will be named "Module2", "Module3" and so on.
If I am creating an Excel workbook, for which I only need one module, I might leave the name as “Module1”. But with Outlook, all my macros have to go here so I have lots of modules. Over the years I have written many routines which I reuse repeatedly. I have one module for general VBA routines, another for routines to access Excel, another for Outlook VBA routines and then one module per Outlook task I perform with macros. If you look at the Properties window you will see the only property of a module is its name. Click on the “Module1” against “Name” and you can change it to any valid (starts with a letter, contains letters and number only, etc.) name. You get strange errors if a module and a procedure have the same name so I start all my module names with “Mod” and I do not use this prefix for my procedures. Why not rename this module “ModIntro” or similar ready for the next part of this tutorial?
These code areas and like the data entry areas of any editor. Click on the code area to select it and type your code or paste in code copied from elsewhere such as the next section of this tutorial.