![]() |
|
#2
|
|||
|
|||
|
Code:
Sub FindTextBetweenWords()
Dim oRng As Word.Range, oPasteRng As Range
Dim oDoc As Document, oTargetDoc As Document
Set oDoc = ActiveDocument
Set oTargetDoc = Documents.Add
oDoc.Activate
Set oRng = oDoc.Range
With oRng.Find
.ClearFormatting
.Wrap = wdFindStop
.MatchCase = False
.Text = "References:*Working paper No"
.MatchWildcards = True
While .Execute
oRng.Select
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Copy
Set oPasteRng = oTargetDoc.Range
oPasteRng.Collapse wdCollapseEnd
oPasteRng.Paste
oRng.Collapse wdCollapseEnd
Wend
End With
lbl_Exit:
Exit Sub
End Sub
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Copying Certain Text From Numerous Cells using Macro
|
Sean_Needs_Help | Excel | 3 | 11-08-2016 04:39 PM |
| Extracting multiple words from one cell into individual rows while copying all other data | randyaserve | Excel Programming | 4 | 10-05-2015 09:52 AM |
| Copying words without initial word space | bertietheblue | Word | 2 | 11-03-2013 04:46 PM |
Macro for Copying Charts to Powerpoint
|
bremen22 | Excel Programming | 1 | 10-01-2013 03:27 PM |
| Macro for replacing, copying and undoing. | vthomeschoolmom | Word VBA | 1 | 12-05-2012 07:41 AM |