E
Ed
I think I've got this right, but I'm not sure. I'm used to using Selection,
and I'm trying to do this in Range. I want to set a range that starts at
the beginning of the document and extends until the end of the paragraph
containing a specified text string. So far, I've got:
' Start at beginning of doc
rngTemp.SetRange(Start:=0, End:=1)
' Find end of range
With ActiveDocument.Range.Find
.Text = "^pFormNo. "
.Forward = True
.Execute
End With
Okay - that should put me where the Form No. is at the bottom of the range I
want. Except I need to extend this to the end of the paragraph, then reset
my rngTemp parameters from the beginning to that point.
First, I'm not sure I did the Find okay. I thought I read somewhere that
you can't mix Selection and Range, so I tried this with Range.
Second, with Selection, I have a visible cursor insertion point that makes
things easier. And I can MoveRight to the end of the paragraph. What am I
moving with Range and how do I move it?
Third, how do I return where I am so I can do another SetRange to include
everything from the beginning to where I am? Or is there a better way?
and I'm trying to do this in Range. I want to set a range that starts at
the beginning of the document and extends until the end of the paragraph
containing a specified text string. So far, I've got:
' Start at beginning of doc
rngTemp.SetRange(Start:=0, End:=1)
' Find end of range
With ActiveDocument.Range.Find
.Text = "^pFormNo. "
.Forward = True
.Execute
End With
Okay - that should put me where the Form No. is at the bottom of the range I
want. Except I need to extend this to the end of the paragraph, then reset
my rngTemp parameters from the beginning to that point.
First, I'm not sure I did the Find okay. I thought I read somewhere that
you can't mix Selection and Range, so I tried this with Range.
Second, with Selection, I have a visible cursor insertion point that makes
things easier. And I can MoveRight to the end of the paragraph. What am I
moving with Range and how do I move it?
Third, how do I return where I am so I can do another SetRange to include
everything from the beginning to where I am? Or is there a better way?