-2

why Word.Application.Selection.Find.Execute does not work in footnote and endnote? my code is:

object wrap = WdFindWrap.wdFindContinue;
object wdReplaceAll = WdReplace.wdReplaceAll;
object text = findWhat;
object replaceText = replaceWith;
object missing = Type.Missing;
object bFormat = true;
object forward = true;
Common.WordApplication.Selection.Find.Execute(ref text, ref missing, ref     missing,
ref missing, ref missing, ref missing, ref forward,
ref wrap, ref bFormat, ref replaceText, ref wdReplaceAll,
ref missing, ref missing, ref missing, ref missing);
Deduplicator
  • 44,692
  • 7
  • 66
  • 118
Amir Niazi
  • 79
  • 8

1 Answers1

0

You should iterate between ActiveDocument.StoryRanges to get all story types in the document. something like:

word.Range myRange = ActiveDocument.StoryRanges[wdMainTextStory]
word.Range myRange = ActiveDocument.StoryRanges[wdFootnotesStory]
myRange.Find.Execute(your parameters)

And so on. Sorry I'm not fan with c#.

abou_hafs
  • 23
  • 1
  • 5