View Single Post
 
Old 07-26-2019, 07:46 AM
kilroy kilroy is offline Windows 10 Office 2016
Competent Performer
 
Join Date: Sep 2016
Location: Southern Ontario
Posts: 122
kilroy is on a distinguished road
Default

This is a variation of Grahams macro. (Code tags not working)


Sub BoldCenterText()
With ActiveDocument
ChangeFont ActiveDocument
End With
End Sub

Function ChangeFont(wdDoc)
Dim oTable As Table
Dim oRng As Range
Dim oRow As Row
Dim strText As String
strText = InputBox("Search text?")
For Each oTable In wdDoc.Tables
For Each oRow In oTable.Rows
If InStr(1, oRow.Range, strText) > 0 Then
Set oRng = oRow.Range
oRow.ConvertToText Separator:=Chr(9)
oRng.Font.Bold = True
oRng.Font.Size = 14
oRng.ParagraphFormat.Alignment = wdAlignParagraphCenter
oRng.InsertParagraphBefore
End If
Next oRow
Next
lbl_Exit:
Set oTable = Nothing
Set oRng = Nothing
Set oRow = Nothing
Exit Function
End Function
Reply With Quote