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 

Ting Vs Charge for Cell Service

I like Ting a lot. The pricing model is well conceived, and the resultant costs are low. The customer service is fantastic. The website and mobile apps function flawlessly. I never get unexpected charges. Laura and I have been on it for three years, and our average...

Biblical Worldview: Creation, Fall, Redemption Promo Video

Biblical Worldview: Creation, Fall, Redemption now has a promo page on bjupress.com. If you haven't yet purchased a copy, you will want to do so now that there is a promo page. Bryan Smith, the presenter on the video there, is the one whose vision I was trying to live...

How to Listen to YouTube Lectures as Podcasts

Update: I have a massively revised version of this set of tips here. I am all the time seeing YouTube lectures I want to listen to—that's right, listen to, not watch. I just can't watch a YouTube lecture. I'm distracted by all the other things I need to do on my...

Listen to YouTube

I don't have time to watch YouTube videos that exceed 8 minutes in length. But there are plenty of lectures and sermons on YouTube that I'd like to listen to that I don't need to watch to benefit from. For the last several months I've been using listentoyoutube.com to...

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.