+ Reply to Thread
Results 1 to 3 of 3

Get data from a word document

Hybrid View

  1. #1
    Daidal
    Guest

    Get data from a word document

    I have an Excel macro that opens two word documents. I want to be able to
    select text from one word document and paste it into the second word document.

    How do I do it?

    I tried using the Range function but I keep getting a Type missmatch error
    (13).

    TIA.

  2. #2
    OJ
    Guest

    Re: Get data from a word document

    Hi,
    You probably need to post this on a Word forum but I believe you need
    to look at the Paragraph property of each word document. It might be
    easier to write the VBA code in word....

    Hth
    OJ


  3. #3
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello

    you want to copy a part or all document ?

    for all document you may try


    Sub fusionnerDeuxDocumentsWord()
    'activate Microsoft Word xx.x Object Library
    '*************************
    'copy first Word text (Doc1)
    'Paste at the end ( and inserBreak) in the second Word doc (Doc2)
    '*************************

    Dim WordApp As Word.Application
    Dim WordDoc1 As Word.Document, WordDoc2 As Word.Document

    Set WordApp = New Word.Application
    WordApp.Visible = True

    Set WordDoc1 = WordApp.Documents.Open(ThisWorkbook.Path & "\Doc1.doc")
    Set WordDoc2 = WordApp.Documents.Open(ThisWorkbook.Path & "\Doc2.doc")

    WordDoc1.Content.Copy

    With WordDoc2.Content
    .Collapse Direction:=wdCollapseEnd
    .InsertBreak Type:=wdSectionBreakNextPage
    .Paste
    End With

    End Sub



    Regards ,
    michel

+ 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