Hello all, I'm new to this thread.
I have written VB code in an Excel file that successfully reads a Word file and stores each line and stores it in a cell.
But I need to write something that can locate and read data, cell by cell, from any Excel files that are embedded in the Word doc and stores that data in the cells of the currently open Excel file.
I searched through posts but couldn't find any relevant posts/replies.
Thanks ahead for any help.
FWIW, here's the code that successfully reads lines from the Word file and stores them in the cells of the currently open Excel file:
Option Explicit
Sub GetWordata()
Dim singleLine As Paragraph
Dim lineText As String
Dim word_app As word.Application
Dim wDoc As word.Document
Dim r As Integer
Dim i As Integer
' word_app.Application.Templates.LoadBuildingBlocks
Set word_app = CreateObject("word.application")
Set wDoc = word_app.Documents.Open("U:/ExcelApps/MergeExcelFiles/test/test.docx")
word_app.Visible = True
i = 1
For Each singleLine In activeDocument.Paragraphs
lineText = singleLine.Range.Text
' MsgBox lineText
Sheets(1).Cells(1, i) = lineText
' Sheets("Data").Cells(1, i) = lineText
i = i + 1
Next singleLine
wDoc.Close
End Sub