O
Omatase
I have a string of text found twice in the same word document. Even
though I indicate a starting point that is before the first instance
of this string and I mark Forward = true the first instance it finds
is the instance at the end of the document. Is there some trick I can
apply to cause it consistently to find the first instance?
Here is my code (aDoc is a Document):
object missingValue = System.Reflection.Missing.Value;
object start = 0;
object end = aDoc.Content.End;
searchResultRange = aDoc.Range(ref start, ref end);
searchResultRange.Find.ClearFormatting();
searchResultRange.Find.Forward = true;
searchResultRange.Find.Text = "zip";
searchResultRange.Find.Wrap = WdFindWrap.wdFindStop;
searchResultRange.Find.Execute(ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue);
I am using Word XP
though I indicate a starting point that is before the first instance
of this string and I mark Forward = true the first instance it finds
is the instance at the end of the document. Is there some trick I can
apply to cause it consistently to find the first instance?
Here is my code (aDoc is a Document):
object missingValue = System.Reflection.Missing.Value;
object start = 0;
object end = aDoc.Content.End;
searchResultRange = aDoc.Range(ref start, ref end);
searchResultRange.Find.ClearFormatting();
searchResultRange.Find.Forward = true;
searchResultRange.Find.Text = "zip";
searchResultRange.Find.Wrap = WdFindWrap.wdFindStop;
searchResultRange.Find.Execute(ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue);
I am using Word XP