Consulting

Results 1 to 2 of 2

Thread: Default Formatting table cells in a document

  1. #1

    Default Formatting table cells in a document

    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

    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

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •