45 min read
VBA & Macros
Record, read, and adjust macros — footer automation without programming theory overload.
When macros beat manual work
Good macro candidates:
- Same footer/header on dozens of similar .docx files
- Apply standard style cleanup to imported legacy docs
- Insert standard boilerplate block
Bad candidates:
- One-off formatting → use styles
- Complex layout decisions → human judgment
- Anything you do not understand on a shared network — security risk
Record and run
Developer → Record Macro → name (no spaces) → store in Current Document or All Documents (Normal.dotm) for global → perform steps → Stop Recording.
Developer → Macros → Run replays steps. Assign to button on Quick Access Toolbar for daily tasks.
Macro security: Developer → Macro Security — only enable trusted locations; never run unknown macros from email.
Reading recorded VBA
Developer → Visual Basic → Modules → double-click module.
Recorded code looks like:
Selection.TypeText Text:="Northgate Academy"
You do not need to master VBA to change literal text, loop files, or comment out one bad line. Read top to bottom — it is the clicks you performed, in order.
Object model basics: Document (whole file), Selection (cursor highlight), Range (start/end positions), Paragraph, Table. Macros manipulate these objects — same things you touch manually.
Small improvements IT might add
For Each loop through documents in a folder — batch footer update.
If statement — skip files already containing footer text.
UserForms — dialog boxes for advanced tools; not required for James's first macro.
Start with record → read → change one string → run on copy.
More lessons in Microsoft Word · Next: Advanced Document Engineering · Previous: Document Automation
