
Originally Posted by
Aussiebear
@Helen269. You were asked what is the logic that determines when to insert the extra space. Your response is weird at best. We don't need to know how you arrived at your "solution' but rather the method of determining when you need a space included.
Sorry, I misunderstood.
And maybe it's because I've slept on it or the coffee I just had, but I found some code that I edited slightly to do what I need. The only trouble is it continues past the selection to the end of the doc:
Sub LineBeforeBold()
With Selection.Find
'Set search criteria for bold font
.Font.Bold = True
'Find next occurrence
.Execute
'Each time bold text is found add a line break before it then find the next one
Do While .Found
Selection.Text = vbCrLf + Selection.Text
.Execute
Loop
End With
End sub
I now just need to figure out how to make it work only on a selection and then stop and not do the rest of the doc. I've tried inserting
.Wrap = wdFindStop
at various points, but that doesn't work. Something to do with Range, maybe...?