Code:
Private Sub CopyToWord()
Dim arr As Variant
arr = Array("A", "B", "C")
With ActiveSheet
.Cells.Clear
For x = 1 To 3
.Range(arr(x - 1) & "1").Value = x
Next x
.Range("A1:C1").Copy
End With
Dim AppWord As Word.Application
Set AppWord = CreateObject("Word.Application")
With AppWord
.Visible = True
.Documents.Add
.Selection.Paste
End With
'''''''''''''''''''''''''''
With AppWord.ActiveDocument.Tables(0)
.Delete
End With
'''''''''''''''''''''''''''
Set AppWord = Nothing
End Sub
Same problem with the highlighted bit
Reported "Application defined or object defined error"
I remember I've learnt to set variable for the table
But here I don't know how to select the table in Word from Excel VBA
And
I want to select the table
as the .Paste command auto copy the Excel data to Word in a table format
I want to do something to the table
like deleting it, adding borders or some styles to it
So
I want to ask how I can control the word table from Excel VBA
Many thanks.