The great thing about creating macros in Word is that you don’t need to know how to program. If you can press record and stop, you can do this.
Aren’t Macros Dangerous?
Have you heard about macros being bad because they can contain viruses? Although you do have to be careful about opening Office documents from unknown people because they might have malicious macros, that’s not an issue here. You make your own macro, so you know it’s not a virus.
How To Record A Macro in Word
For this example, you’re going to create a macro in Word to insert your signature at the end of a document.
How To Write a Macro
For most macros, the recording method is the most efficient way to create them. Eventually, you’ll want to do something more complex. This requires writing the macro in the Visual Basic for Applications (VBA) language. We’ve got the best VBA guide for beginners, so bookmark that. Let’s create a macro to give us the average words per sentence to help us tell when we’re being wordy. Dim s As RangeDim numWords As IntegerDim numSentences As IntegernumSentences = 0numWords = 0 For Each s In ActiveDocument.Sentences numSentences = numSentences + 1 numWords = numWords + s.Words.CountNext MsgBox “Average words per sentence” + Str(Int(numWords / numSentences)) + “. Less than 15 is best.”
My Macro Doesn’t Work When I Save My Word Document
Word defaults to save with the file extension .docx, which doesn’t allow macros to automatically run. If you want the macro to run, you’ll need to change the file type to Word Macro-Enabled Document (*.docm). This filetype exists partly to combat macro security issues. If you see this file extension on a document you weren’t expecting to receive, be suspicious.
What Else Can I Do With Macros?
You can create macros in Excel, Outlook, even PowerPoint. Anything that you’re currently doing manually, you should be able to record or write a macro to do it. Using macros in Word along with great Windows shortcut keys will amplify your productivity tenfold.