![]() |
#1
|
|||
|
|||
![]() I have a doc with sentences containing an em dash in the middle. How can I get all those sentences as bold? Examples: The Purpose and Method of Luke’s Gospel—Read Luke 1:1-4 Zacharias Ministers in the Temple—Read Luke 1:5-10 |
#2
|
||||
|
||||
![]()
Unless your text spans an entire paragraph or an entire line delineated with manual line breaks, what you're asking for isn't possible. That's because Word has no Find/Replace tools for finding grammatical sentences. The same limitation applies to VBA.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Hi Paul,
Yes, the text spans an entire paragraph and there is a manual line break at the end. |
#4
|
||||
|
||||
![]()
Please clarify - paragraph breaks and manual line breaks are entirely different things.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
The document is downloaded from the internet with manual line breaks (arrow pointing to the left), but I can easily change them to paragraph breaks if it's easier to perform the bold
|
#6
|
||||
|
||||
![]()
Try a wildcard Find/Replace, where:
Find = [!^13^11]@^0151[!^13^11]@[^13^11] Replace = ^& and you specify the replacement format as bold. As a macro, this might be implemented along the following lines: Code:
Sub Demo() Application.ScreenUpdating = False With ActiveDocument.Range With .Find .ClearFormatting .Text = "[!^13^11]@^0151[!^13^11]@[^13^11]" With .Replacement .ClearFormatting .Text = "^&" .Font.Bold = True End With .Forward = True .Wrap = wdFindContinue .Format = True .MatchWildcards = True .Execute Replace:=wdReplaceAll End With End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
![]()
Thank you Paul. Wish I could say I understand what's happening, but it works well.
|
#8
|
||||
|
||||
![]()
The 'Find' is a wildcard expression that looks for:
• any series of characters other than a paragraph break or line break - [!^13^11]@ • followed by an em-dash - ^0151 • followed by any series of characters other than a paragraph break or line break - [!^13^11]@ • followed by a paragraph break or line break - [^13^11] The 'Replace' expression retains what is found - ^& For more details, see: http://www.gmayor.com/replace_using_wildcards.htm http://word.mvps.org/FAQs/General/UsingWildcards.htm
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
![]()
Yes thanks Paul. I had seen those two sites, just wasn't understanding how it was strung together.
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
bertietheblue | Word Tables | 2 | 07-26-2015 07:26 AM |
![]() |
footer-assistance | Word | 1 | 06-29-2015 03:49 AM |
![]() |
Andoheb | Word | 29 | 07-03-2014 01:48 PM |
Format Bold in one line makes all lines bold | Nitte | Word | 2 | 02-07-2013 12:34 AM |
![]() |
Bobosmite | Word | 2 | 05-06-2011 04:21 AM |