VBA Word: Bold cell's text till break line

I need to go through one column in my word table and change font to bold for all characters from the first one to first breakline so that would be the string im interested in:

                zz = Left(oCell.Range.Text, InStr(oCell.Range.Text, Chr(13)) - 1)

Im having difficulties in highlighting the 'zz' part of every cell


With appWord
            For Each oCell In .Tables(1).Range.Columns(2).Cells
                

                With .Selection
                    .Bold = True
                End With
            Next
        End With

Open in new window

LVL 3
yahoooooAsked:
Who is Participating?
 
GrahamSkanConnect With a Mentor RetiredCommented:
You need to work on a document, not application, so I've renamed the variable to emphasise that
With docWord
        For Each oCell In .Tables(1).Range.Columns(2).Cells
            oCell.Range.Paragraphs.First.Range.Bold = True
        Next
    End With

Open in new window

0
 
yahoooooAuthor Commented:
sry for confusion, i should put on top Dim appWord As Object as well

works great :D Didnt think that I can treat cell like a word document ;)
 thanks
0
All Courses

From novice to tech pro — start learning today.