Good afternoon all,
I am having trouble automating Word in order to open a word file, copy all of the containing text and pasting it into my excel sheet range. The macro is bugging out at the ".Selection.Copy" portion of the code with the error message "Object doesn't support this property or method." So now I'm kind of stuck. I'm trying to import data from a word file into excel. Can anyone take a look and see what may be going on? I do have the word properties library enabled as well.
Sub MakeMemos()
' Creates memos in word using Automation
Dim WordApp As Object
Dim Data As Range, message As String
Dim Records As Integer, i As Integer
Dim Region As String, SalesAmt As String, SalesNum As String
Dim SaveAsName As String
' Start Word and create an object (late binding)
Set WordApp = CreateObject("Word.Application")
' Information from worksheet
Set Data = Sheets("Sheet1").Range("A1")
message = Sheets("Sheet1").Range("A2")
' Cycle through all records in Sheet1
' Determine the filename
SaveAsName = "C:\Users\adam\Desktop\test.docx"
With WordApp
.Documents.Open ("C:\Users\adam\Desktop\test.docx")
With WordApp.Selection.Document
.Selection.Copy
End With
.ActiveDocument.SaveAs Filename:=SaveAsName
End With
' Kill the objectd
WordApp.Quit
Set WordApp = Nothing
Range("A11").select
Selection.Paste
End Sub
Bookmarks