+ Reply to Thread
Results 1 to 4 of 4

grabbing data from MS Word

  1. #1
    Registered User
    Join Date
    08-18-2005
    Posts
    3

    grabbing data from MS Word

    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

  2. #2
    Registered User
    Join Date
    08-18-2005
    Posts
    3
    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?

  3. #3
    Registered User
    Join Date
    08-18-2005
    Posts
    3
    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.

  4. #4
    Tom Ogilvy
    Guest

    Re: grabbing data from MS Word

    http://support.microsoft.com/kb/185476/EN-US/
    How To Search Directories to Find or List Files

    http://support.microsoft.com/kb/185601/EN-US/
    HOW TO: Recursively Search Directories by Using FileSystemObject

    http://support.microsoft.com/kb/186118/EN-US/
    How To Use FileSystemObject with Visual Basic

    --
    Regards,
    Tom Ogilvy


    "nims" <[email protected]> wrote in message
    news:[email protected]...
    >
    > 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.
    >
    >
    > --
    > nims
    > ------------------------------------------------------------------------
    > nims's Profile:

    http://www.excelforum.com/member.php...o&userid=26426
    > View this thread: http://www.excelforum.com/showthread...hreadid=396941
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1