Forum Discussion
MeganMaverick
Oct 13, 2023Copper Contributor
Macro or style for not line-splitting double dashes?
I follow a style guide that requires double dashes (--) to be on one line and not split across two. Is there any way to automate searching for and correcting this issue? Relatively new to automating Word.
Thanks!
7 Replies
Sort By
- editingbyritaCopper Contributor
MeganMaverick Hi Megan,
It's probably too late but I recently set up a macro to do this. I am also in transcription. In find/replace, use Find: "-^l-" without quotes (that's a lowercase L); Replace: "--" without quotes. This should fix it. This is basically what I programmed my macro to look for and then replace.
If you know how to make a macro or are willing to google how, use the following coding:
Sub Dash()
'
' Dash Macro
'
'
With Selection.Find
.Text = "-^l-"
.Replacement.Text = "--"
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub - Charles_KenyonBronze Contributor
Does your style guide allow use of a real N-dash (–) or M-dash (—) rather than the two hyphen substitute? That is available using AutoFormat as you type.
- hyphen-- double hyphen
– N-dash
— M-dashAutoFormat and AutoFormat As You Type hyphen conversion differences
If you can use one of those true dashes, then you can use Replace to replace the double hyphen with one of the true dashes.
- MeganMaverickCopper Contributor
Charles_KenyonUnfortunately, our style guide does not allow N- or M-dashes.
- Charles_KenyonBronze Contributor
This is not something done with a style. Period.
Take a look at the non-breaking hyphen available in Word.
https://support.microsoft.com/en-us/office/keep-text-together-af94e5b8-3a5a-4cb0-9c53-dea56b43d96d
Try creating one and then using Replace to replace two of the ordinary hyphens with two like this. You can paste two into the "Replace with" box.
Talk to whomever is in charge of your style guide. Using -- instead of true dashes is typewriter-era documentation and just plain wrong! This was a substitute for a true dash because none was available on a typewriter and there is really no excuse for using it in this day and age.