Sometimes you want to do a repetitive task in Word and you think, ‘It’s a computer – it can see what I want to do, why can’t it just carry on and finish the job?’ In this situation make a macro to do the job. All you have to do is carry out the task once while recording your keystrokes then it takes just four clicks to carry out that same task. To record a macro:
- make sure that you have Developer on your toolbar as described here.
- click on Record Macro
3. give your macro a name, without any spaces. It is traditional to use capital letters at the start of a word and join them together.
4. Press ok. From now on every keystroke you make is recorded and turned into lines of VBA code. It will only record keystrokes though, not mouse actions.
5. When you have finished press Stop Recording. You now have some lines of code which will do the job for you.
6. To access your macro in future, go to the macro icon. Mine is on the Quick Access Toolbar as I use it a lot, but it’s also in Developer:
7. Clicking on it will bring up a list of your macros in alphabetical order. Click Run to run it or Step Into to see what your code looks like.
8. If you use your macro a lot, add it to the Quick Access Toolbar as described here. From then on it is always visible, whatever you are doing to any document, and it takes just one click to run it.