I am using this code to insert an underlined and bold header with a non-formatted paragraph underneath. I am able to append the second paragraph below the header in the cell, but I lose the formatting for the header:
The result is supposed to look like this:
<b><u>Header</u></b>
A medium sized paragraph with 3-5 sentences. A medium sized paragraph with 3-5 sentences. A medium sized paragraph with 3-5 sentences.
But I get:
Header
A medium sized paragraph with 3-5 sentences. A medium sized paragraph with 3-5 sentences. A medium sized paragraph with 3-5 sentences.
Code:
Sub T1()
Dim myText1 As String
Dim myText2 As String
myText1 = "Header"
myText2 = "A medium sized paragraph with 3-5 sentences. A medium sized paragraph with 3-5 sentences. A medium sized paragraph with 3-5 sentences. "
With ActiveDocument.Tables(1).Cell(2, 2).Range
.Font.Name = "Times New Roman"
.Font.Size = 12
.Font.Bold = True
.Font.Underline = True
.Text = myText1 & vbCr & vbCr
.Font.Bold = False
.Font.Underline = False
.InsertAfter myText2
End With
End Sub
The result is supposed to look like this:
<b><u>Header</u></b>
A medium sized paragraph with 3-5 sentences. A medium sized paragraph with 3-5 sentences. A medium sized paragraph with 3-5 sentences.
But I get:
Header
A medium sized paragraph with 3-5 sentences. A medium sized paragraph with 3-5 sentences. A medium sized paragraph with 3-5 sentences.
Last edited: