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 

Future.Bible Conference

Future.Bible Conference

In one week I'll be "speaking" "at" a "conference" on the future of the Bible that is all online—actually, I recorded the video today and am now uploading it. My talk was really fun to put together, and I gave it this title: "Anything Invented After You're Thirty-Five...

Review: The Innovators

Review: The Innovators

The Innovators: How a Group of Hackers, Geniuses and Geeks Created the Digital Revolution by Walter IsaacsonMy rating: 5 of 5 starsSomehow some writers of biography end up sounding trite, both in their relating of their subjects' stories and in the lessons they draw...

Ode to My iPad Pro

Ode to My iPad Pro

The subtitle for this blog used to be “Bible, Tech, Bible Tech.” I haven’t blogged about tech much in a long time. But I still love it. And it’s time for a break from heavy stuff. One particular piece of tech I love is my new-to-me 12.9-inch iPad Pro. I got it a few...

A Handy Guide to Catching Spam Comments

Look out for these things in your comment spam (some apply to email spam, too), and you're less likely to be fooled by it (click image to see full-size): I don't really mean that Australia is weird, though I may find out this summer that it is as I take my first trip...

Leave a comment.

3 Comments

  1. James

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

    Reply
  2. 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.

    Reply

Leave a Reply