Reputation: 3931
I'm trying to insert a line break into a table cell. So far I've been trying to manipulate the range of the cell, but am either getting errors or causing my text to go into subsequent rows or outside of the table.
How would I insert a line break into a table cell?
(Using macros, there is apparently a way to do it with Selection, but I'd rather avoid that if possible)
(Things I have that don't work: range.InsertParagrah, range.InsertParagraphAfter, range.Text = "\r\n", range.InsertBreak(wdLineBreak))
Upvotes: 3
Views: 12863
Reputation: 3736
This works in Word 2010, you'll need to have the correct cell etc. selected:
Selection.TypeText Text:=Chr(11)
/edit/
How about this? Forgive the use of Selection to get the range, I know you don't like it but it was the quickest way for me to test. You can use your own way to get the range.
Sub Macro3()
Dim oRange As Range
' Add your own range selection code here!
Set oRange = Selection.Range
oRange.InsertAfter (Chr(11))
End Sub
Upvotes: 2