![]() |
|
#2
|
||||
|
||||
|
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 |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Copying tables between Word documents | FIN | Word | 1 | 02-10-2015 05:59 PM |
| Copying Selected Text Between Word Documents | Iluvatar343 | Word VBA | 1 | 06-05-2014 05:15 AM |
Find and Replace multiple lines/paragraphs
|
jcw | Word | 1 | 11-18-2011 11:47 AM |
MS Excel 2004 for Mac - copying dates between documents
|
BCRenton | Excel | 4 | 11-10-2009 07:28 AM |
| Copying tables between Word documents best practices? | dylane | Word Tables | 0 | 12-18-2008 12:21 PM |