To search for a word in a Word document using C#

S

sereneo

Hi All,

I am currently using C# to search through a word document. My version
of Word used is 2000. I was wondering if the following is possible:

- I am trying to search AND extract text which begin with
"<<ScriptAnswer.". The full string might be
"<<ScriptAnswer.12345678>>". How can I do this?

Thanks for all help!
 
S

sereneo

Would like to add that when i tried to do the following:

WordApp.Selection.Find.ClearFormatting();
WordApp.Selection.Find.Text = "<<ScriptAnswer."

WordApp.Selection.Find.MatchCase = false;
WordApp.Selection.Find.Forward = true;
WordApp.Selection.Find.Wrap = Word.WdFindWrap.wdFindContinue;
WordApp.Selection.Find.MatchSoundsLike = true;
WordApp.Selection.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);

the error
"An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in Simple.exe

Additional information: Exception from HRESULT: 0x800A15CA."
was thrown.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top