![]() |
|
|
|
#1
|
||||
|
||||
|
Based on your other post in this forum
Code:
Dim p As Paragraph
Dim oRng As Range
Dim Thistext As String
Dim meetssomecondition As Boolean
For Each p In ActiveDocument.Paragraphs
meetssomecondition = False
Thistext = p.Range.Text
If InStr(1, Thistext, "-") > 0 Then meetssomecondition = True
If meetssomecondition = True Then
Set oRng = p.Range 'set a range to the paragraph
oRng.Collapse 1 'collapse the range to its start
oRng.MoveEndUntil "-" 'move the end of the range to the hyphen
oRng.Font.Bold = True 'format the range
End If
Next p
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Find, select, and replace part of text with bold
|
paik1002 | Word VBA | 4 | 12-07-2015 11:24 PM |
| How to parse bold sections of a paragraph? | XmisterIS | Word VBA | 2 | 03-31-2014 02:54 PM |
Set style for part of paragraph
|
meileetan | Word | 7 | 06-07-2013 01:09 AM |
Set paragraph text to bold.
|
Sorcerer13 | Word | 1 | 09-04-2012 11:08 AM |
How to indent only half part of the paragraph 2em
|
Samahu | Word | 2 | 01-17-2011 08:15 AM |