![]() |
|
#1
|
||||
|
||||
![]() It seems fairly straightforward. How about: Code:
Sub ExtractText() 'Seb AllenThursday, 26 March 2015 at 16:13 UTC Dim oSource As Document Dim oTarget As Document Dim oRng As Range Set oSource = ActiveDocument 'Create a document to hold the extracts Set oTarget = Documents.Add 'replace line breaks with paragraph breaks Set oRng = oSource.Range oRng.Text = Replace(oRng.Text, Chr(11), Chr(13)) With oRng.Find 'Find the times Do While .Execute(FindText:="at [0-9]{2}:[0-9]{2} UTC", _ MatchWildcards:=True) 'Copy the paragraph containing the found time to the new document oTarget.Range.InsertAfter oRng.Paragraphs(1).Range.Text oRng.Collapse 0 DoEvents Loop End With lbl_Exit: 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 |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
MMT | Excel | 9 | 02-12-2015 09:18 PM |
Extracting specific rows | sbdk82 | Excel | 4 | 09-07-2014 10:24 PM |
Formatting contents after Tab of continuous lines or formatting specific area of word | pawii | Word | 1 | 05-12-2014 05:24 AM |
![]() |
Flambo | Word | 2 | 05-06-2012 10:43 PM |
![]() |
zsmithku | Word | 1 | 04-15-2011 03:46 PM |