![]() |
|
#1
|
|||
|
|||
|
Hello all,
I have the following code which formats a specific piece of text in a mail merge document, however the text is in a series of cells, and I would like to be able to format the actual cell rather than the text itself. Is there a way to modify the code I have to do this? Many thanks, Luke Code:
Sub HighlightTargetsN()
Dim range As range
Dim i As Long
Dim TargetList
TargetList = Array("MMN") ' put list of terms to find here
For i = 0 To UBound(TargetList)
Set range = ActiveDocument.range
With range.Find
.Text = TargetList(i)
.Format = True
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
Do While .Execute(Forward:=True) = True
range.HighlightColorIndex = wdRed
range.Bold = True
range.Font.ColorIndex = wdRed
range.Font.Underline = wdUnderlineThick
range.Font.UnderlineColor = wdRed
range.Font.Name = "TW Cen MT"
range.Font.Size = 14
Loop
End With
Next
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
VBA and hyperlinks in table cells
|
viuf | PowerPoint | 13 | 02-19-2012 10:34 AM |
Make Cells Mimic The Formatting Of One Cell
|
skoz55 | Excel | 1 | 11-09-2011 09:00 AM |
Copy table cell formatting across multiple cells / tables
|
pakistanray | Word Tables | 2 | 10-31-2011 08:07 AM |
| Formatting Cells for Currency and Accounting | Sparetyme | Excel | 1 | 07-11-2010 01:26 PM |
Cut and paste a range of cells and preserve formatting
|
StarWeaver | Excel | 1 | 03-02-2010 01:41 PM |