Change two hyphens to a dash

S

Steve

I have a new system (Windows Me) and I just loaded Office 2000.
When I enter two hyphens after a word, they do not change into a dash.

In the option:
Tools\Auto Correct\Autoformat as you type\
and under the category in the middle, titled "Replace as you type"
there is a checkbox labeled:
"Symbol characters (--) with symbols (-)
That box is checked.
It was checked by default during installation.
But the dash does not appear automatically.

Is this a bug?

Steve
 
D

Dayo Mitchell

It doesn't change unless you have two hyphens between two words, with no
intervening spaces. So the AutoFormat doesn't trigger until you type the
space after the second word. By design.

You can change this by adding an AutoCorrect to change two hyphens into a
dash, and it will trigger immediately.

DM
 
L

Larry

Rather than use the AutoFormat to get your M dashes, it might be easier
to assign a convenient keystroke to the built in command. By default,
the M dash is inserted by the key combination Alt+Ctrl+Num(-) (that's
the hyphen in the numerical keypad at the far right of your keyboard).
If you go to the Customize Keyboard dialog box (Tools, Customize,
Keyboard) and choose Common Symbols in the left pane and Em dash in the
right pane, you could assign an additional, more user-friendly key
combination to this. That way you don't have to type the two hyphens,
then type something else, then see the hyphens turn into the M dash; you
just insert the M dash, and that's it.

Larry
 
J

Jeff

That is very useful to know.

Since I type mostly on a laptop which does not have a separate numerical
keypad, the normal shortcuts for Em and En were essentially unavailable for
me. Following your instructions I added Alt+Ctrl+- and Ctrl+- respectively
even though these were assigned to other things. What do you use in your
setup?

Thanks.

Incidentally info about the em dash shortcut is almost impossible to find in
Word's help system. What is finally found only points to the autocorrect
method.

--

Jeff McPherson
Email address deliberately false to avoid spam
(e-mail address removed)
Outgoing mail is certified Virus Free by AVG
 
L

Larry

Jeff,

You're right, information about the em dash is lacking. It's an
important character, that is used all the time, but Word does not make
it easy to use.

However, I'm not sure about assigning Ctrl+- to the em dash as that is
assigned by default to the Optional Hyphen which is something you don't
want to lose the ability to type occasionally. And Alt+Ctrl+- is
assigned to ToolsCustomizeRemoveMenuShortcuts which is an essential
command for removing buttons from menus, especially for removing
documents from the Work menu.

Personally I use Alt+\. That way it takes only one hand and my hand
doesn't have to leave the main keyboard. However, in a laptop, I'm not
sure if that key combo is as handy as on my regular keyboard.

However, I have Alt+\ assigned, not to the built-in em dash, but to my
own macro which does a few extra things. If I'm typing in Courier or
Courier New, it inserts non-breaking double hyphens instead of an em
dash; if I'm typing in any other font, it inserts the em dash, and it
also deletes whatever punctuation is in the interword space before
inserting the em dash. This is very handy as I often, for example,
change a comma and space between two words to an em dash between two
words. With my macro, I don't have to delete the pre-existing
characters in addition to inserting the em dash, I just press Alt+\ and
the whole thing is accomplished in one step.

If you'd like that macro, write back to the group and I'll share it with
you.

Larry
 
J

Jeff

I really like your suggestion for alternative keys for em. They are just as
handy on a laptop keyboard. I too do many of the things you say you find
your macro useful for, so I would love to have it. However since I am not an
expert with Word Macros, you would need to also tell me how to make it
available for Word 2002 to find and use.

Also, after deleting the new keyboard shortcuts I just added for em and en,
how do I restore Ctrl+- and Alt+Ctrl+- to their original functions?

Thank you very much.

--

Jeff McPherson
Email address deliberately false to avoid spam
(e-mail address removed)
Outgoing mail is certified Virus Free by AVG
 
S

Suzanne S. Barnhill

Also, after deleting the new keyboard shortcuts I just added for em and
en,
how do I restore Ctrl+- and Alt+Ctrl+- to their original functions?

You don't need to do anything further. When you assigned new functions to
them, the old functions were not overwritten, just superseded. Now that
you've released them, they'll be restored to the default.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
L

Larry

Jeff,

This macro selects any spaces, commas or other punctuation in the
interword space around the IP, then types non-breaking double hyphen if
selection font is Courier or Courier New, or types em dash if selection
font is any other font. When it inserts the em dash or double hyphen,
it wipes out all of the selected previous punctuation so it doesn't have
to be deleted. The macro also toggles between dash and comma.

The double hyphen consists of a non-breaking hyphen followed by a
regular hyphen. This keeps the two hyphens always together and always
attached to the preceding word so the double hyphen doesn't break across
two lines, which unfortunately is what happens in Word with two regular
hyphens.

For instructions on installing a macro, see
http://www.mvps.org/word/FAQs/MacrosVBA/CreateAMacro.htm

Let me know how it goes.

Larry

Sub EmDashOrDoubleHyphenInsert()
' by Larry

Application.ScreenUpdating = False
System.Cursor = wdCursorNormal
' Move selection forward and backward over any space, comma, _
paren, hyphen, M dash, or nonbreaking space (including 3- and
4-dot ellipsis).
With Selection
.MoveEndWhile cset:=" ,-():;." & Chr(30) & Chr(151) & Chr(160) _
& Chr(133) & Chr(150), Count:=8
.MoveStartWhile cset:=" ,-():;." & Chr(30) & Chr(151) & Chr(160) _
& Chr(133) & Chr(150), Count:=-8
' If there is already double hyphen or M dash in space, replace by
comma and space
If .Text = Chr(30) & "-" Or .Text = Chr(151) Then
.TypeText ", "
ElseIf .Font.Name = "Courier" Or .Font.Name = "Courier New" Then
.TypeText Chr(30) & "-"
Else: .TypeText Chr(151)
End If
End With
End Sub
 
J

Jeff

Terrific!

--

Jeff McPherson
Email address deliberately false to avoid spam
(e-mail address removed)
Outgoing mail is certified Virus Free by AVG
 
J

Jeff

Let me know how it goes.

I installed the macro. However when I ran it (in Word 2002), I get
"Compile error: syntax error". the debugger opens with
"4-dot ellipsis) ."
highlighted. There is a space between the ) and the .

Any ideas?

--

Jeff McPherson
Email address deliberately false to avoid spam
(e-mail address removed)
Outgoing mail is certified Virus Free by AVG
 
J

Jeff

Dear Larry,

I figured out the problem. Your macro works perfectly.

What happened was that I cut and pasted your script, but did not realize
that 2 of the lines had wrapped. When I corrected for that, it worked fine.

Thank you very much.

--

Jeff McPherson
Email address deliberately false to avoid spam
(e-mail address removed)
Outgoing mail is certified Virus Free by AVG
 
L

Larry

Great. I noticed that bad line wrap after I posted my message, but
figured you would figure it out.

Larry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top