Attached Word doc and Excel database need to be in same Folder.
Word has twenty three fields, but Macro below is copying only twelve into the Database, and inserting a blank column between each for some reason?
Option Explicit
Dim wordApp As Word.Application
Dim wDoc As Word.Document
Dim i, n As Integer
Sub DATAFROMWORD()
Set wordApp = CreateObject("word.application")
Set wDoc = wordApp.Documents.Open(ThisWorkbook.Path & "/" & Range("E1").Value & ".docx")
wordApp.Visible = True
With Sheet2
n = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
For i = 1 To 23
Sheet2.Cells(n, i) = wDoc.ContentControls(i).Range.Text
i = i + 1
Next i
End With
wordApp.Documents.Close
wordApp.Quit
End Sub
Hopefully someone will spot the problem?
All solutions, suggestions and alternatives welcome as ever.
Ochimus
Bookmarks