grabbing data from MS Word

N

nims

I'm trying to create code for excel that will allow me to open a series
of word documents, copy certain rows from tables in those docs, and
paste them into the excel worksheet.

The main problem I'm having is with formatting. I am able to paste the
data in Excel, but there are characters added for spaces in the cells.

Here is my code:

Dim oWrd As Object
Set oWrd = CreateObject("Word.Application")

Dim oDoc As Object
Set oDoc = CreateObject("Word.Document")

Set oDoc = oWrd.Documents.Open("c:\OMA\TIJ_90442.doc")
'oWrd.Visible = False

ActiveWorkbook.Worksheets(1).Cells(6, 1) = oDoc.Tables(1).Rows(1)
ActiveWorkbook.Worksheets(1).Cells(5, 2) = oDoc.Tables(3).Cell(3, 5)

oWrd.Quit
Set oWrd = Nothing
 
N

nims

I figured out how to paste the rows properly, but what is the code I
need so every row is pasted below the previous one?
 
N

nims

I figured that out too! lol!

What I can't seem to do is search a directory and all subdirectories
for .doc files. I can search 1 directory, but I don't know how to
search subdirectories.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top