+ Reply to Thread
Results 1 to 2 of 2

Copy from WORD to EXCEL using a macro.....

  1. #1
    Tee
    Guest

    Copy from WORD to EXCEL using a macro.....

    I have the following macro that opens a word document from excel..

    *****************************************************

    'Sub OpenWord()

    '
    ' OpenWord Macro
    ' Macro recorded 28/02/2006 by rivers
    '


    Set appWd = CreateObject("Word.Application")
    appWd.Visible = True

    ChDir "S:\PROJECTS\Paypoint-zone"

    appWd.Documents.Open FileName:="S:\PROJECTS\Paypoint-zone\Invoice.rtf"

    'End Sub


    ****************************************************

    This opens word and the document "invoice".

    I would like to know if anyone knows how I can write a macro to copy the
    text in the word document into my excel spreadsheet that is open???????

    (I usually do this by highlighting the text on the word doc and doing an
    edit/paste special.)

    Then close the word document and return to the excel spreadsheet....

    HHHHHEEEEEEEELLLLLLLLPPPPPPPPP.................................






  2. #2
    Steve Yandl
    Guest

    Re: Copy from WORD to EXCEL using a macro.....

    How is the text organized in the Word document? You can return any or all
    of the text without using copy/paste or even having the Word document
    visible. You generally have to do some text manipulation because you will
    import things like end of paragraph marks that will appear as odd characters
    in Excel but it is generally simple enoug to handle. Below is an example
    that will bring all the text in the body of the document into cell A1.

    Sub GrabFromWord()
    Set objWd = CreateObject("Word.Application")
    Set objDoc = objWd.Documents.Open("C:\Test\TestB.doc")
    Set myRange = objDoc.Range(0, 0)
    myRange.WholeStory
    strStory = myRange.Text
    Cells(1, 1).Value = strStory
    objDoc.Close
    objWd.Quit
    Set objWd = Nothing
    End Sub


    Steve


    "Tee" <Tee@discussions.microsoft.com> wrote in message
    news:DAD8C8EB-2BF7-4335-8AC6-9F53273DD07B@microsoft.com...
    >I have the following macro that opens a word document from excel..
    >
    > *****************************************************
    >
    > 'Sub OpenWord()
    >
    > '
    > ' OpenWord Macro
    > ' Macro recorded 28/02/2006 by rivers
    > '
    >
    >
    > Set appWd = CreateObject("Word.Application")
    > appWd.Visible = True
    >
    > ChDir "S:\PROJECTS\Paypoint-zone"
    >
    > appWd.Documents.Open FileName:="S:\PROJECTS\Paypoint-zone\Invoice.rtf"
    >
    > 'End Sub
    >
    >
    > ****************************************************
    >
    > This opens word and the document "invoice".
    >
    > I would like to know if anyone knows how I can write a macro to copy the
    > text in the word document into my excel spreadsheet that is open???????
    >
    > (I usually do this by highlighting the text on the word doc and doing an
    > edit/paste special.)
    >
    > Then close the word document and return to the excel spreadsheet....
    >
    > HHHHHEEEEEEEELLLLLLLLPPPPPPPPP.................................
    >
    >
    >
    >
    >




+ 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