I'm trying to copy a bunch of tabs to word. I can get it to create new word documents over an over but I need it to populate the tables in one word document.
Here's my code:
Sub CopyTable()
Dim wdappWord As Word.Application
Dim docWord As Word.Document
Set wdappWord = GetObject("C:\Excel\Excel Test", "Word.Application")
Set docWord = wdappWord.Documents.Add
wdappWord.Visible = True
wkshtCopyFrom.Select
Range("B2:I5").Select
Selection.Copy
wdappWord.Selection.PasteExcelTable True, False, False
End Sub
I get an error at the "GetObject" command. Anyone know why?
Here's my code:
Sub CopyTable()
Dim wdappWord As Word.Application
Dim docWord As Word.Document
Set wdappWord = GetObject("C:\Excel\Excel Test", "Word.Application")
Set docWord = wdappWord.Documents.Add
wdappWord.Visible = True
wkshtCopyFrom.Select
Range("B2:I5").Select
Selection.Copy
wdappWord.Selection.PasteExcelTable True, False, False
End Sub
I get an error at the "GetObject" command. Anyone know why?