Finding text of more than 255 characters

D

Dan

Hi,
I am trying to write a utility in C# .NET 2.0 to recursively scan through
directories looking for .DOC files, opening them using automation and
find/replace text (as simply opening the files and find/replace in will
damage the format of the .DOC files)

I couldn't have replacement text of 255 characters or more as the function
could not accept this. I found a workaround for this in this very forum but
unfortunatly I cannot think of a workaround for expanding the size of the
search parameter.

--->

You can't force the Replacement.Text to carry more than 255 characters, BUT

* You have the option of putting the text on the clipboard, then
inserting the clipboard content. For this, use the following string as
Replacement.Text = "^c"
* Loop through the document with FIND (but not Replace) and explicitly
insert the content. Very roughly:
rng.Find.Execute("<body>", false, false, false, false, false, true,
wdFindStop, false, missing, missing, false, false, false, false)
Note that this VB syntax and that I explicitly set some of the
parameters rather than passing "missing". This is because, if the user has
activated any of these options, they will apply to your search

At this point, rng now contains the "found" text. So: rng.Text = "my
substitution that's more than 255 characters."

<----


Any ideas?
Thanks in advance for any help!
 

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