Does anyone have a macro or shortcut to stitch spelled words with non-breaking hyphens?

Views: 134

Replies to This Discussion

I don't know the answer, but I'd like to learn. I don't work in Word, but I would like to someday. That is why I am looking forward to contributions to this section of the forum.

In WP5.1 for DOS, there is a feature called a "hard hyphen," which means everything before and after the HARD HYPHEN will stay together on one line.

There is also another feature called "hard space" that works the same way. For example, if a person's name is Mr. de los Reyes, the "de" would end up at the end of one line and "los Reyes" be at the beginning of the next line. The HARD SPACE feature keeps those words together.

If this is the feature you mean, then try this in Microsoft Word: press CTRL+SHIFT+HYPHEN.
Thanks for the shortcut on that one. Wasn't exactly what I was looking for, but it will work.

Again, I'm lazy. In CAT software, you can highlight a word, hit the dashes, and it will stitch a dash between each letter in one go. They are non-breaking so it takes the whole word to the next line if necessary. I will dig out the hard space in Word to keep words and names together. I'm sure it is in there somewhere too.

I need to play with WP one of these days soon. It has been a long time, but I remember it being very user friendly.
I've been gleaning quite a bit of information from the Productivity Talk website I mentioned. Ed Weber is the wizard of macros. I posted a question last night asking for help, and voila! This morning Ed posted this. Works like a charm!! The word doesn't have to be capped, just type, have your cursor in the word and hit your shortcut key. If you have multiple words to stitch, highlight and hit the short cut key and it stitches each word. This will be a great time saver for me.


Sub StitchWords()
'by Ed Weber
'It is not necessary to a select a word just place the cursor on a word.
'The macro will make the word uppercase and add hypens. Hello will become H-E-L-L-O.
'For two or more successive words, select the words. Holy cow will become H-O-L-Y C-O-W
'Note there is no hyphen between HOLY and COW.
Dim rngAction As Range
Dim Temp As String
Temp = ""
If Selection.Type = wdSelectionIP Then
Selection.End = Selection.End + 1
If InStr(";:., " & vbTab & vbCr, Selection.Range.Text) > 0 Then Selection.Start = Selection.Start - 1
Set rngAction = Selection.Range.Words(1)

Else
Set rngAction = Selection.Range
End If
If Right(rngAction.Text, 1) = " " Then rngAction.End = rngAction.End - 1
If Left(rngAction.Text, 1) = " " Then rngAction.Start = rngAction.Start + 1
rngAction.Case = wdUpperCase
For j = 1 To Len(rngAction) - 1
If Mid(rngAction, j, 1) <> " " Then
If Mid(rngAction, j + 1, 1) <> " " Then
Temp = Temp & Mid(rngAction, j, 1) & "-"
Else
Temp = Temp & Mid(rngAction, j, 1) & " "
End If
End If
Next j
Temp = Temp & Right(rngAction, 1)
rngAction.Delete
rngAction.InsertBefore Temp
rngAction.Collapse wdCollapseEnd
rngAction.Select
Set rngAction = Nothing
End Sub

RSS

Latest Activity

Allison Marullo commented on Janet's page Proofreaders
22 hours ago
Kelli Combs (admin) left a comment for Hanna Jenkin
Friday
Elise Thompson updated their profile
Friday
Profile IconElise Thompson and Jennifer Matteo joined Kelli Combs (admin)'s group
Friday
Elise Thompson joined Mary Abbott Burkes's group
Friday
Profile IconElise Thompson and Jennifer Matteo joined CSRNation
Thursday
Jennifer Matteo updated their profile
Thursday
Pattie Walker updated their profile
Dec 20
michael chait posted a status
"Searching for a reporter with 2 days a week available to work for my agency in New Haven area. We pay promptly &extra for live attendance."
Dec 20
Cathy Houser left a comment for Shelley Schniepp
Dec 19
Pohlman USA joined Kelli Combs (admin)'s group
Dec 18
Hanna Jenkin updated their profile
Dec 17

© 2024   Created by Kelli Combs (admin).   Powered by

Badges  |  Report an Issue  |  Terms of Service