STEVE-BART
06-06-2016, 02:24 AM
Hi, I'm looking for help as I'm completely baffled!
Hi have VBA code which opens a word document and writes text into individual cells.
This is fine and I can also format individual cells
What I cant work out how to do is format individual lines separately within a cell.
Heres my code so far:-
Set wrdApp = CreateObject("Word.Application")
Set wrddoc = wrdApp.Documents.Open("C:\Table Trials.docx")
wrdApp.Visible = True
wrddoc.Tables(2).Cell(2, 4).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
t = "Start line" '& vbNewLine & "Mid line" & Chr(10) & "last line"
wrddoc.Tables(2).Cell(2, 4).Range.Text = t
With wrddoc.Tables(2).Cell(2, 4).Range
.Font.ColorIndex = wdBlue
End With
end sub
Many thanks in anticipation
Hi have VBA code which opens a word document and writes text into individual cells.
This is fine and I can also format individual cells
What I cant work out how to do is format individual lines separately within a cell.
Heres my code so far:-
Set wrdApp = CreateObject("Word.Application")
Set wrddoc = wrdApp.Documents.Open("C:\Table Trials.docx")
wrdApp.Visible = True
wrddoc.Tables(2).Cell(2, 4).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
t = "Start line" '& vbNewLine & "Mid line" & Chr(10) & "last line"
wrddoc.Tables(2).Cell(2, 4).Range.Text = t
With wrddoc.Tables(2).Cell(2, 4).Range
.Font.ColorIndex = wdBlue
End With
end sub
Many thanks in anticipation