Mark Ward’s Miracle Word-Macro Wonder

by Apr 20, 2009Tech3 comments

The MWMWMW is now available for free—for a limited time only (till the Internet dies, I guess).

Use this macro to 1) sharpen up any Word document and 2) impress nerdy people with proper use of a) en dashes and b) em dashes.

This macro replaces — with —. It also removes spaces surrounding em dashes, makes all hyphens between numbers into en dashes, turns all quotation marks and apostrophes into curvy quotes (as long as you have “Smart-quotes” turned on), replaces all double spaces with single spaces, and generally makes me feel good about the typographical state of my documents.

Just open a blank Word document, hit Alt+F8, click “Edit,” and paste the text below into your macros list at the bottom. Save and close Word, agreeing to save changes to Normal.dot. You can even assign a button or keyboard shortcut to this macro.

Sub MWMWMW()
' Mark Ward's Miracle Word-Macro Wonder
' Macro recorded Thursday, September 11, 2003 by Mark L Ward Jr
   Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " "
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = """"
.Replacement.Text = """"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "'"
.Replacement.Text = "'"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "--"
.Replacement.Text = "—"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " — "
.Replacement.Text = "—"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " —"
.Replacement.Text = "—"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "— "
.Replacement.Text = "—"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([0-9])-([0-9])"
.Replacement.Text = "\1–\2"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub

Read More 

Review: Andy Crouch’s The Tech-Wise Family

Andy Crouch is among the first parents to have nurtured children from clearly-too-young-to-have-a-smartphone to now-old-enough, during a time in which smartphones were in fact available for that whole period. It's only been ten years since the iPhone's debut. And in...

Review: 12 Ways Your Phone is Changing You

12 Ways Your Phone is Changing You by Tony Reinke My rating: 5 of 5 stars The best way to summarize this book is probably to let the author do it. In the last twelve chapters, I have warned against twelve corresponding ways in which smartphones are changing us and...

Cool New Way to Use the Best Word Processor

I love Google Docs. I live by Google Docs. I can't believe I ever lived with anything else. It strikes just the right balance between simplicity and power. It's made for writers like me who constantly need to send out documents for edits and comments without causing a...

Leave a comment.

3 Comments
  1. James

    Coolness! But what have you got for Word 2008 users who don’t have macros…?

  2. Mark L Ward Jr

    This guy says you can code your VBA applications in AppleScript…

  3. Duncan

    I don’t know about Macs, but I still do VBA in Word 2007 (on Windows, mind you). In the Word Options dialog you turn on the Developer toolbar and then you can get into all the lovely internals of Office 07! (Or just type Alt+F11)

    In order to save macros in a 2007 Word doc, the file extension changes from*.docx to *.docm.

    Nice macro, BTW… I think a lot of those settings in the With Selection.Find blocks could be trimmed out though. Word always worries about too many details with recorded macros. I’ll let you know if I can achieve the same results with trimmed code.