F
FIRSTROUNDKO via OfficeKB.com
Hi!
Can somebody please tell me why this Code stops at pTarget, i think its an
easy we you know who situation.
I am trying to copy the range abc "other stuff" xyz with is not in the same
paragraph
Sub abcxyz()
Dim pH1 As Word.Range
Dim pH2 As Word.Range
Dim pTarget As Word.Range
Set pH1 = ActiveDocument.Range
With pH1.Find
.ClearFormatting
.Text = "abc"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = False
End With
Set pH2 = ActiveDocument.Range
With pH2.Find
.ClearFormatting
.Text = "xyz"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = False
End With
Set pTarget = ActiveDocument.Range(Start:=pH1.End + 1, End:=pH2.Start - 1)
pTarget.Copy
wrdApp.Documents.Add DocumentType:=wdNewBlankDocument
pTarget.Paste
End Sub
Thanks in advance
Can somebody please tell me why this Code stops at pTarget, i think its an
easy we you know who situation.
I am trying to copy the range abc "other stuff" xyz with is not in the same
paragraph
Sub abcxyz()
Dim pH1 As Word.Range
Dim pH2 As Word.Range
Dim pTarget As Word.Range
Set pH1 = ActiveDocument.Range
With pH1.Find
.ClearFormatting
.Text = "abc"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = False
End With
Set pH2 = ActiveDocument.Range
With pH2.Find
.ClearFormatting
.Text = "xyz"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = False
End With
Set pTarget = ActiveDocument.Range(Start:=pH1.End + 1, End:=pH2.Start - 1)
pTarget.Copy
wrdApp.Documents.Add DocumentType:=wdNewBlankDocument
pTarget.Paste
End Sub
Thanks in advance