Hi, I'm trying to paste text from Excel to Word. I cannot get it to work right - everything is pasted on line 1 in Word. The previously pasted text gets replaces by the later pasted text.
Here's the macro I've been trying to use:
Sub TW()
Dim AppWD As Word.Application
Dim DocWD As Word.Document
Dim RangeWD As Word.Range
Set AppWD = CreateObject("Word.Application.11")
AppWD.Visible = True
Set DocWD = AppWD.Documents.Add
With DocWD
With ActiveDocument
.AutoHyphenation = True
.HyphenateCaps = True
.HyphenationZone = CentimetersToPoints(0.63)
.ConsecutiveHyphensLimit = 0
End With
Set RangeWD = .Range
Sheets("T").Select
Range("A15").Select
Selection.Copy
With RangeWD
.Font.Name = "Arial"
.Font.Size = 12
.Font.Bold = True
.PasteSpecial DataType:=wdPasteText, Placement:=wdInLine
.InsertParagraphAfter
.Collapse wdCollapseEnd
.InsertParagraphAfter
End With
Set RangeWD = .Range
Sheets("T").Select
Range("A17").Select
Selection.Copy
With RangeWD
.Font.Name = "Arial"
.Font.Size = 12
.Font.Bold = True
.PasteSpecial DataType:=wdPasteText, Placement:=wdInLine
.InsertParagraphAfter
'.InsertParagraphAfter
.Collapse wdCollapseEnd
.InsertParagraphAfter
End With
End With
Sheets("S").Activate
End Sub
Here's the macro I've been trying to use:
Sub TW()
Dim AppWD As Word.Application
Dim DocWD As Word.Document
Dim RangeWD As Word.Range
Set AppWD = CreateObject("Word.Application.11")
AppWD.Visible = True
Set DocWD = AppWD.Documents.Add
With DocWD
With ActiveDocument
.AutoHyphenation = True
.HyphenateCaps = True
.HyphenationZone = CentimetersToPoints(0.63)
.ConsecutiveHyphensLimit = 0
End With
Set RangeWD = .Range
Sheets("T").Select
Range("A15").Select
Selection.Copy
With RangeWD
.Font.Name = "Arial"
.Font.Size = 12
.Font.Bold = True
.PasteSpecial DataType:=wdPasteText, Placement:=wdInLine
.InsertParagraphAfter
.Collapse wdCollapseEnd
.InsertParagraphAfter
End With
Set RangeWD = .Range
Sheets("T").Select
Range("A17").Select
Selection.Copy
With RangeWD
.Font.Name = "Arial"
.Font.Size = 12
.Font.Bold = True
.PasteSpecial DataType:=wdPasteText, Placement:=wdInLine
.InsertParagraphAfter
'.InsertParagraphAfter
.Collapse wdCollapseEnd
.InsertParagraphAfter
End With
End With
Sheets("S").Activate
End Sub