View Single Post
 
Old 02-19-2016, 05:40 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

If you copy and paste the texts, that will clear the original clipboard content so the short answer is no. However it would be possible to search a batch of documents for a particular text string and reproduce the paragraphs containing that text in the current document, without the need to copy and paste e.g.
Code:
Option Explicit

Sub Copy_Paras()
Dim strPath As String
Dim strFilename As String
Dim oTarget As Document
Dim oDoc As Document
Dim oRng As Range
Dim oRng2 As Range
Dim strText As String

    Set oTarget = ActiveDocument
    Set oRng2 = Selection.Range
    strText = InputBox("Enter the text to find")
    If strText = "" Then GoTo lbl_Exit
    strPath = "C:\Path\"        'The folder with the documents

    strFilename = Dir$(strPath & "*.docx")
    While Len(strFilename) <> 0
        Set oDoc = Documents.Open(strPath & strFilename)
        Set oRng = oDoc.Range
        With oRng.Find
            Do While .Execute(FindText:=strText)
                oRng2.Text = oRng.Paragraphs(1).Range.Text
            Loop
        End With
        oDoc.Close SaveChanges:=0
        strFilename = Dir$()
        DoEvents
    Wend
lbl_Exit:
    Set oRng = Nothing
    Set oRng2 = Nothing
    Set oDoc = Nothing
    Set oTarget = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote