Making Dashes Easy

While using Microsoft Word, I’ve often thought how great it would be if I could type two hyphens and get an em dash. Also, when I type a hyphen after a number, I want the hyphen to turn into an en dash to indicate inclusive numbers, like these: 3-10. Microsoft Word 97, 98, and 2000 try to address the em-dash issue with the AutoCorrect (as you type) feature, but they muff it by requiring three hyphens for an em dash and two hyphens for an en dash. How intuitive is that?

I decided to fix the problem myself with the following procedure:

1. Insert an em dash into my document (click “Insert,” then “Symbol,” then the em dash [eighth column, fifth row], then “Insert”).

2. Select and copy the em dash.

3. Move my cursor so the dash is no longer selected.

4. Click “Tools.”

5. Click “AutoCorrect.” (In Word 97, 98, or 2000, I might also have to click the “AutoCorrect” tab.)

6. Turn on “Replace Text as You Type.”

7. In the “Replace” box, type two hyphens.

8. In the “With” box, paste that em dash I copied from my document.

9. Click OK.

Now when I type two hyphens together, I get an em dash. Pretty neat!

But how about that automatic en dash after a number? Well, it wouldn’t be too hard to type in these AutoCorrect entries:

Replace 0- with 0= (I’m using the equal sign to represent an en dash in this e-mail newsletter)

Replace 1- with 1=

Replace 2- with 2=

And so on, up to 9.

The problem is, Microsoft Word sees each entry as a whole word, which means if I type a double- or triple-digit number followed by a hyphen, the hyphen doesn’t change. Does that mean I have to insert all of those double- and triple-digit numbers by hand to make my dream come true? (There are 999 of them.) Well, since I’m a programmer, the answer is no. I’ll just write a macro to do it. And I’ll share it with you here, with the understanding that *you use it at your own risk.* (I don’t anticipate any problems, but I can’t be responsible for your computer.)

The macro will create AutoCorrect entries for single-, double-, and triple-digit numbers. (In case you change your mind, I’ll also include a macro to remove the entries. Please don’t try to remove them by hand; it will take you forever and could cause problems if you try to run the “remove” macro later.)

Once you’ve run the macro, you’ll get an en dash if you type a hyphen after a one-, two-, or three-digit number. You’ll also get an en dash after a number like 3,435. Why? Because Word interprets the comma as the end of a word, leaving the three digits together as another word. If you type an inclusive date, like “1951-52,” however, the hyphen will remain a hyphen. That’s probably all right because many editors prefer to include the full years anyway, like this: 1951-1952.

What about those times when you just want the hyphen after a number to be a hyphen? Type the number and hyphen (which will become an en dash). Then use CTRL-Z to undo the hyphen’s metamorphosis. And, of course, you can always turn off “Replace Text as You Type” or run the macro that removes the digit-dash AutoCorrect entries.

Be sure to use the right macro for your operating system (PC or Macintosh) and version of Microsoft Word (6/7 [95], 97/98, or 2000).

To create the macro in Word 6 or 7 (95):

1. Copy the appropriate macro from this newsletter.

2. Click “Tools.”

3. Click “Macro.”

4. Make sure “Macros Available In” shows Normal.dot.

5. Type a name for the macro in the “Macro Name” box. The name could be something like “AddEntries” or “RemoveEntries” (depending on which macro you’re using).

6. Click “Create.”

7. Paste the macro at the current insertion point.

8. Click “File,” then “Close,” then “Yes.”

To use the macro in Word 6 or 7 (95):

1. Click “Tools.”

2. Click “Macro.”

3. Make sure “Macros Available In” shows Normal.dot.

4. Click the macro that has the name you gave it (such as “AddEntries”).

5. Click “Run” and wait for the macro to finish.

The macro will add (or remove) the AutoCorrect entries. Now if you type a hyphen after a number, you’ll get an en dash.

To create the macro in Word 97, 98, or 2000:

1. Copy the appropriate macro from this newsletter.

2. Click “Tools.”

3. Click “Macro.”

4. Click “Macros.”

5. Make sure “Macros In” shows Normal.dot.

6. Type a name for the macro in the “Macro Name” box. The name could be something like “AddEntries” or “RemoveEntries” (depending on which macro you’re using).

7. Click “Create.”

8. Paste the macro at the current insertion point.

9. Click “File,” then “Close and Return to Microsoft Word.”

To use the macro in Word 97, 98, or 2000:

1. Click “Tools.”

2. Click “Macro.”

3. Click “Macros.”

4. Make sure “Macros Available In” shows Normal.dot.

5. Click the macro that has the name you gave it (such as “AddEntries”).

6. Click “Run” and wait for the macro to finish. The macro will add (or remove) the AutoCorrect entries. Now if you type a hyphen after a number, you’ll get an en dash.

________________________________________

________________________________________

MACROS TO ADD ENTRIES
________________________________________

________________________________________

________________________________________

FOR MICROSOFT WORD 6 OR 7 (95) ON THE PC

'THE MACRO STARTS HERE
On Error Resume Next
'SINGLE DIGITS
For a = 1 To 9
ToolsAutoCorrect .ReplaceText = 1, 
.Replace = LTrim$(Str$(a)) + "-", 
.With = LTrim$(Str$(a)) + Chr$(150), .Add
Next a
'DOUBLE DIGITS
For a = 1 To 9
For b = 0 To 9
ToolsAutoCorrect .ReplaceText = 1, 
.Replace = LTrim$(Str$(a)) + LTrim$(Str$(b)) + "-", 
.With = LTrim$(Str$(a)) + LTrim$(Str$(b)) + Chr$(150), .Add
Next b
Next a
'TRIPLE DIGITS
For a = 1 To 9
For b = 0 To 9
For c = 0 To 9
ToolsAutoCorrect .ReplaceText = 1, 
.Replace = LTrim$(Str$(a)) + LTrim$(Str$(b)) + 
LTrim$(Str$(c)) + "-", .With = LTrim$(Str$(a)) + 
LTrim$(Str$(b)) + LTrim$(Str$(c)) + Chr$(150), .Add
Next c
Next b
Next a
'THE MACRO ENDS HERE

________________________________________

FOR MICROSOFT WORD 6 ON THE MACINTOSH

'THE MACRO STARTS HERE
On Error Resume Next
'SINGLE DIGITS
For a = 1 To 9
ToolsAutoCorrect .ReplaceText = 1, 
.Replace = LTrim$(Str$(a)) + "-", 
.With = LTrim$(Str$(a)) + Chr$(208), .Add
Next a
'DOUBLE DIGITS
For a = 1 To 9
For b = 0 To 9
ToolsAutoCorrect .ReplaceText = 1, 
.Replace = LTrim$(Str$(a)) + LTrim$(Str$(b)) + "-", 
.With = LTrim$(Str$(a)) + LTrim$(Str$(b)) + Chr$(208), .Add
Next b
Next a
'TRIPLE DIGITS
For a = 1 To 9
For b = 0 To 9
For c = 0 To 9
ToolsAutoCorrect .ReplaceText = 1, 
.Replace = LTrim$(Str$(a)) + LTrim$(Str$(b)) + 
LTrim$(Str$(c)) + "-", .With = LTrim$(Str$(a)) + 
LTrim$(Str$(b)) + LTrim$(Str$(c)) + Chr$(208), .Add
Next c
Next b
Next a
'THE MACRO ENDS HERE

________________________________________

FOR MICROSOFT WORD 97 OR 2000 ON THE PC

'THE MACRO STARTS HERE
Dim a
Dim b
Dim c
On Error Resume Next
'SINGLE DIGITS
For a = 1 To 9
WordBasic.ToolsAutoCorrect ReplaceText:=1, _
Replace:=WordBasic.[LTrim$](Str(a)) + "-", _
With:=WordBasic.[LTrim$](Str(a)) + Chr(150), Add:=1
Next a
'DOUBLE DIGITS
For a = 1 To 9
For b = 0 To 9
WordBasic.ToolsAutoCorrect ReplaceText:=1, _
Replace:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + "-", _
With:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + Chr(150), Add:=1
Next b
Next a
'TRIPLE DIGITS
For a = 1 To 9
For b = 0 To 9
For c = 0 To 9
WordBasic.ToolsAutoCorrect ReplaceText:=1, _
Replace:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + _
WordBasic.[LTrim$](Str(c)) + "-", _
With:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + _
WordBasic.[LTrim$](Str(c)) + Chr(150), Add:=1
Next c
Next b
Next a
'THE MACRO ENDS HERE

________________________________________

FOR MICROSOFT WORD 98 ON THE MACINTOSH

'THE MACRO STARTS HERE
Dim a
Dim b
Dim c
On Error Resume Next
'SINGLE DIGITS
For a = 1 To 9
WordBasic.ToolsAutoCorrect ReplaceText:=1, _
Replace:=WordBasic.[LTrim$](Str(a)) + "-", _
With:=WordBasic.[LTrim$](Str(a)) + Chr(208), Add:=1
Next a
'DOUBLE DIGITS
For a = 1 To 9
For b = 0 To 9
WordBasic.ToolsAutoCorrect ReplaceText:=1, _
Replace:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + "-", _
With:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + Chr(208), Add:=1
Next b
Next a
'TRIPLE DIGITS
For a = 1 To 9
For b = 0 To 9
For c = 0 To 9
WordBasic.ToolsAutoCorrect ReplaceText:=1, _
Replace:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + _
WordBasic.[LTrim$](Str(c)) + "-", _
With:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + _
WordBasic.[LTrim$](Str(c)) + Chr(208), Add:=1
Next c
Next b
Next a
'THE MACRO ENDS HERE

________________________________________

________________________________________

MACROS TO REMOVE ENTRIES
________________________________________

________________________________________

________________________________________

FOR MICROSOFT WORD 6 OR 7 (95) ON THE PC

'THE MACRO STARTS HERE
On Error Resume Next
'SINGLE DIGITS
For a = 1 To 9
ToolsAutoCorrect .ReplaceText = 1, 
.Replace = LTrim$(Str$(a)) + "-", 
.With = LTrim$(Str$(a)) + Chr$(150), .Delete
Next a
'DOUBLE DIGITS
For a = 1 To 9
For b = 0 To 9
ToolsAutoCorrect .ReplaceText = 1, 
.Replace = LTrim$(Str$(a)) + LTrim$(Str$(b)) + "-", 
.With = LTrim$(Str$(a)) + LTrim$(Str$(b)) + Chr$(150), .Delete
Next b
Next a
'TRIPLE DIGITS
For a = 1 To 9
For b = 0 To 9
For c = 0 To 9
ToolsAutoCorrect .ReplaceText = 1, 
.Replace = LTrim$(Str$(a)) + LTrim$(Str$(b)) + 
LTrim$(Str$(c)) + "-", .With = LTrim$(Str$(a)) + 
LTrim$(Str$(b)) + LTrim$(Str$(c)) + Chr$(150), .Delete
Next c
Next b
Next a
'THE MACRO ENDS HERE

________________________________________

FOR MICROSOFT WORD 6 ON THE MACINTOSH

'THE MACRO STARTS HERE
On Error Resume Next
'SINGLE DIGITS
For a = 1 To 9
ToolsAutoCorrect .ReplaceText = 1, 
.Replace = LTrim$(Str$(a)) + "-", 
.With = LTrim$(Str$(a)) + Chr$(208), .Delete
Next a
'DOUBLE DIGITS
For a = 1 To 9
For b = 0 To 9
ToolsAutoCorrect .ReplaceText = 1, 
.Replace = LTrim$(Str$(a)) + LTrim$(Str$(b)) + "-", 
.With = LTrim$(Str$(a)) + LTrim$(Str$(b)) + Chr$(208), .Delete
Next b
Next a
'TRIPLE DIGITS
For a = 1 To 9
For b = 0 To 9
For c = 0 To 9
ToolsAutoCorrect .ReplaceText = 1, 
.Replace = LTrim$(Str$(a)) + LTrim$(Str$(b)) + 
LTrim$(Str$(c)) + "-", .With = LTrim$(Str$(a)) + 
LTrim$(Str$(b)) + LTrim$(Str$(c)) + Chr$(208), .Delete
Next c
Next b
Next a
'THE MACRO ENDS HERE

________________________________________

FOR MICROSOFT WORD 97 OR 2000 ON THE PC

'THE MACRO STARTS HERE
Dim a
Dim b
Dim c
On Error Resume Next
'SINGLE DIGITS
For a = 1 To 9
WordBasic.ToolsAutoCorrect ReplaceText:=1, _
Replace:=WordBasic.[LTrim$](Str(a)) + "-", _
With:=WordBasic.[LTrim$](Str(a)) + Chr(150), Delete:=1
Next a
'DOUBLE DIGITS
For a = 1 To 9
For b = 0 To 9
WordBasic.ToolsAutoCorrect ReplaceText:=1, _
Replace:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + "-", _
With:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + Chr(150), Delete:=1
Next b
Next a
'TRIPLE DIGITS
For a = 1 To 9
For b = 0 To 9
For c = 0 To 9
WordBasic.ToolsAutoCorrect ReplaceText:=1, _
Replace:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + _
WordBasic.[LTrim$](Str(c)) + "-", _
With:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + _
WordBasic.[LTrim$](Str(c)) + Chr(150), Delete:=1
Next c
Next b
Next a
'THE MACRO ENDS HERE

________________________________________

FOR MICROSOFT WORD 98 ON THE MACINTOSH

'THE MACRO STARTS HERE
Dim a
Dim b
Dim c
On Error Resume Next
'SINGLE DIGITS
For a = 1 To 9
WordBasic.ToolsAutoCorrect ReplaceText:=1, _
Replace:=WordBasic.[LTrim$](Str(a)) + "-", _
With:=WordBasic.[LTrim$](Str(a)) + Chr(208), Delete:=1
Next a
'DOUBLE DIGITS
For a = 1 To 9
For b = 0 To 9
WordBasic.ToolsAutoCorrect ReplaceText:=1, _
Replace:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + "-", _
With:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + Chr(208), Delete:=1
Next b
Next a
'TRIPLE DIGITS
For a = 1 To 9
For b = 0 To 9
For c = 0 To 9
WordBasic.ToolsAutoCorrect ReplaceText:=1, _
Replace:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + _
WordBasic.[LTrim$](Str(c)) + "-", _
With:=WordBasic.[LTrim$](Str(a)) + _
WordBasic.[LTrim$](Str(b)) + _
WordBasic.[LTrim$](Str(c)) + Chr(208), Delete:=1
Next c
Next b
Next a
'THE MACRO ENDS HERE

This entry was posted in Editing. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

You must be logged in to post a comment.

  • The Fine Print

    Thanks for reading Editorium Update (ISSN 1534-1283), published by:

    The EDITORIUM, LLC
    http://www.editorium.com

    Articles © on date of publication by the Editorium. All rights reserved. Editorium Update and Editorium are trademarks of the Editorium.

    You may forward copies of Editorium Update to others (but not charge for it) and print or store it for your personal use. Any other broadcast, publication, retransmission, copying, or storage, without written permission from the Editorium, is strictly prohibited. If you’re interested in reprinting one of our articles, please send an email message to editor@editorium.com

    Editorium Update is provided for informational purposes only and without a warranty of any kind, either express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, and freedom from infringement. The user (you) assumes the entire risk as to the accuracy and use of this document.

    The Editorium is not affiliated with Microsoft Corporation or any other entity.

    We do not sell, rent, or give our subscriber list to anyone.