![]() |
#2
|
||||
|
||||
![]()
That should be fairly simple e.g. with the cursor in the first of the two paragraphs run the following
Code:
Sub Macro1() 'Graham Mayor - http://www.gmayor.com - Last updated - 12 Jan 2018 Dim oRng As Range Dim strEndWord() As Variant Dim i As Long strEndWord = Array("so", "jas", "mf") Set oRng = Selection.Paragraphs(1).Range If oRng.Start = ActiveDocument.Paragraphs.Last.Range.Start Then MsgBox "You cannot process the last paragraph!" GoTo lbl_Exit End If With oRng .Font.Bold = True .End = .Words(1).End - 1 .InsertAfter ChrW(9658) .End = .End + 1 .Font.ColorIndex = wdRed .End = .Paragraphs(1).Range.End .End = .Next.Paragraphs(1).Range.End - 1 .Start = .Words.Last.Start For i = 0 To UBound(strEndWord) If strEndWord(i) = LCase(.Text) Then .InsertBefore vbTab .Font.Bold = True Exit For End If Next i End With lbl_Exit: Set oRng = Nothing Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Setting part of a paragraph bold | Fred256 | Word VBA | 4 | 10-07-2016 02:54 PM |
How to parse bold sections of a paragraph? | XmisterIS | Word VBA | 2 | 03-31-2014 02:54 PM |
![]() |
Sorcerer13 | Word | 1 | 09-04-2012 11:08 AM |
![]() |
Jamal NUMAN | Word | 3 | 04-10-2011 02:49 PM |
paragraph sign appearing in document | ajetrumpet | Word | 1 | 08-24-2010 05:46 AM |