Hi everyone,

I am writing a program that searches for a especific text in a Word document
and replaces it with another text. I am finding that there is a limit in the
length of the text that will replace the original text.

Does anyone know what is this limit, and if there's a way to get over this
limit?

Thanks, from Spain

Juan

Re: Limit in "Find -- Replace" by Klaus

Klaus
Fri Dec 12 10:30:42 CST 2003

Hi Juan,

The "official" limit is 255 characters. Any string longer than that will
give you a "Run-time error '5854': String too long".

But I've noticed crashes with strings that were a bit shorter, so I would be
careful even with strings close to 255 bytes.

As a work-around, you can copy text to the clipboard and use ^c in the
Replacement text, or use "Find" to locate the text and insert your string:

While Selection.Find.Execute
Selection.Text = String(300, "x")
Selection.Collapse (wdCollapseEnd)
Wend

Greetings,
Klaus


"Juan" <juan_magana@hotmail.com> schrieb:
> Hi everyone,
>
> I am writing a program that searches for a especific text in a Word
> document and replaces it with another text. I am finding that there
> is a limit in the length of the text that will replace the original text.
>
> Does anyone know what is this limit, and if there's a way to get
> over this limit?
>
> Thanks, from Spain
>
> Juan