I have the below working code. I added the With statement but it formats all text on page. This code takes each row from an excel table and extracts the column header (question) and the cell value (answer) just below it.
My goal is to have the question in bold and one font size and the answer below it normal font and a smaller size. I tried wrapping the With statement around just the header code but it still stylizes the entire page
For Each cell In tbl.DataBodyRange.Rows:
If cell.EntireRow.Hidden = False Then
hiddenCell = cell.Row
For Each Header In tbl.HeaderRowRange:
With WordDoc
.Styles(wdStyleHeading1).Font.Name = "Arial"
.Styles(wdStyleHeading1).Font.Size = 12
.Styles(wdStyleHeading1).Font.Bold = True
.Styles(wdStyleHeading1).Font.Color = wdColorBlack
.Range(0).Style = .Styles(wdStyleHeading1)
headerCol = wks.Cells.Find(Header).Column
WordDoc.Content.InsertAfter (vbNewLine)
WordDoc.Content.InsertAfter Range(Header.Address).Value & ": "
WordDoc.Content.InsertAfter (vbNewLine)
WordDoc.Content.InsertAfter (Cells(hiddenCell, headerCol).Value)
'WordDoc.Content.InsertAfter (vbNewLine)
End With
Next
WordDoc.Sections.Add