View Single Post
 
Old 04-01-2014, 01:42 AM
Hoxton118 Hoxton118 is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Mar 2014
Posts: 21
Hoxton118 is on a distinguished road
Default

Many thanks. I've tried to insert the code as follows (and lots of other ways too) but cannot make it work. Please advise where I've made an error. Thanks.

Code:
Sub CopyParas()
'
' CopyParas Macro
'
Dim range As range
Dim TargetList, i As Long
TargetList = InputBox("Put list of terms to find here, separated by commas")
For i = 0 To UBound(Split(TargetList, ","))
  MsgBox Split(TargetList, ",")(i)
Next
For i = 0 To UBound(TargetList)
Selection.Find.ClearFormatting
With Selection.Find
.Text = TargetList(i)
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Do While Selection.Find.Execute
Selection.StartOf Unit:=wdParagraph
Selection.MoveEnd Unit:=wdParagraph
sBigString = sBigString + Selection.Text
Selection.MoveStart Unit:=wdParagraph
Loop
Next
Documents.Add DocumentType:=wdNewBlankDocument
Selection.InsertAfter (sBigString)
End Sub
Reply With Quote