What Are Macros?
Macros are sequences of instructions which tell your MS Office applications what actions to carry out. Macros can be generated using the Macro Recorder function in Word and Excel (Powerpoint lost the function some versions ago). The approach is to start the Macro Recorder, carry out the sequence of actions and selections that you want the macro to reproduce when you run it subsequently, and then stop the recorder at the end of the sequence. If you make an error while recording, you must go back to the beginning and repeat the process.
The macros produced by the recorder are fine if you only want to do the exactly same thing over and over again, and in exactly the same circumstances. They can’t react to different conditions and, of course, they can only run once before you have to trigger them again.
This is where custom-written macros come in; we can make them repeat their actions until all the relevant data has been processed, reacting in different ways to what the program code finds in the data itself if necessary. The custom-written macros can also carry out long and complex sequences of actions very quickly and accurately. Virtually every feature of the MS Office applications can be controlled by macros (program code), but many of those features can’t be accessed by the Macro Recorder.
Beyond Single-Application Macros
The MS Office suite of applications has been designed so that they can communicate with each other, sharing data and controlling one another. This means, for example, that Excel and the Access database – which do not produce editable reports – can send data to Word to produce fully-editable reports, formatted just as you want.
Data and control needn’t just flow one way, of course. If you have an Access or Excel database of clients and you want to collect information from them, you can use the database to generate personalised Word forms for your clients to complete and return. When the forms come back, the database can extract the data from them and present it to you in a wide variety of formats. This might include Powerpoint presentations, Excel charts or Word reports.
Recorded macros and custom-written program code enable us to build systems which do precisely what the client requires. They can range from the simple to the complex: we can combine the data management facilities of Access/Excel with the formatting capability of Word and then, if we need to, send the completed report via e‑mail, using Outlook.
Whenever we add custom-written program code to a project, we supply a User Guide which explains what the additional functions do and how to use them.