I am generating a macro that copies data from excel to word, but it marks me an error, I behave the code that I have, hoping they can help me.
Sub copiar_word()
Dim wordapp As Object
Dim x, a As Integer
x = 8
Set wordapp = CreateObject("word.Application")
With wordapp
.Visible = True
.Activate
.Documents.Add
End With
c = ActiveSheet.Range("a" & x).Value
Do While c <> ""
ActiveSheet.Range("a" & x).Select
Selection.Copy
wordapp.Selection.PasteSpecial link:=True
If ActiveSheet.Range("a" & x + 1).Value = "" Then
a = x + 1
Do While ActiveSheet.Range("a" & a).Select = ""
a = a + 1
Loop
ActiveSheet.Range(Cells(x, 2), Cells(a, 2)).Select
Selection.Copy
wordapp.Selection.PasteSpecial link:=True
x = x + a
Else
ActiveSheet.Range("b" & x).Select
Selection.Copy
wordapp.Selection.PasteSpecial link:=True
x = x + 1
End If
Loop
End Sub