Re: String too long...
- From: "Tony Jollans" <My forename at my surname dot com>
- Date: Tue, 30 Jan 2007 11:51:04 -0000
Oh yeah I did try on Word 2003 and still reproduce the error.
What error exactly (I know, string too long!) and under what circumstances? Please post code that is failing and indicate where.
So, you know what, we still haven't figured out how to position the Selection to the Range's found text!
First of all, when you said in an earlier post that it's not the ticket what is your problem with RangeObject.Select? Are you saying it does not select the Range?
Secondly, I'll ask again, why are you so intent on using the Selection? Greg has demonstrated how to use a Range. There are two (related) issues with using the selection - it reflects what you are doing on screen in full view of the user and this can be annoying because the screen can flicker and also it is inefficient.
--
Enjoy,
Tony
"mike" <m@xxxxx> wrote in message news:OrcV89$QHHA.3500@xxxxxxxxxxxxxxxxxxxxxxx
Iv'e not really heard of the AutoText except in the searches for the dreaded run-time error 5854.
Oh yeah I did try on Word 2003 and still reproduce the error.
In my case I don't need Replace all, there is a preliminary run-through of the document that occurs. It is preparation for the database queries, and then afterwords the replace is within an overall ForEach loop.
So, you know what, we still haven't figured out how to position the Selection to the Range's found text!
"Greg Maxey" <gmaxey@xxxxxxxxxxxxxxxxxxx> wrote in message news:%23tZc8g$QHHA.4060@xxxxxxxxxxxxxxxxxxxxxxx
Mike,
My website mainly addresses the limitation of "finding" text that is longer than "255" characters. Your find text <Additional_Items> is not the problem.
The "replace" text limitation is easily overcome using the contents of the clipboard or an autotext (Replace All) works in both cases.
Neither method you have found or that I proposed invokes "Replace All" and so while it appears to the observer to be a find and replace operation it is actually more of a "find and then change what is found" ;-)
I don't think there is anything wrong with using the selection.typetext method. I have just gathered from nosing around in these groups that range seems to be preferred over selection when possible. I believe it may be a little quicker, but for most jobs the advantage may be negliable.
--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
"mike" <m@xxxxx> wrote in message news:%23tEGBE$QHHA.920@xxxxxxxxxxxxxxxxxxxxxxx
I am beginning to wonder, is it maybe a version thing?
I have to support Word 2000 and perhaps that is why my environment errors when placing 256 characters into Range.Text
I am guessing that the code below is you stating that it is OK to exceed 255 characters? If so I am confused as to why you would demonstrate that while your web page shows how to alleviate the error?
At any rate, what might your apprehensions be with using Selection.TypeText after having found with the Range object, is there an issue of some sort that I should be aware of?
I have been thinking that, similar to a cursor, we'd simply move it to where the Range.Find is now pointing and TypeText into the location.
"Greg Maxey" <gmaxey@xxxxxxxx> wrote in message news:1170093004.695834.207920@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I wouldn't think one would want to implement slection.typetext when.
working with a range. Seems one would use range.text = whatever the
string is.
Is something like this what you are looking for:
im oRng As Word.Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "<mytag>"
While .Execute
oRng.Text = "1111111111111111111111111111111111111111111111111" _
& "1111111111111111111111111111111111111111111111111" _
& "1111111111111111111111111111111111111111111111111" _
& "1111111111111111111111111111111111111111111111111" _
& "1111111111111111111111111111111111111111111111111" _
& "1111111111111111111111111111111111111111111111111" _
& "1111111111111111111111111111111111111111111111111" _
& "1111111111111111111111111111111111111111111111111" _
& "1111111111111111111111111111111111111111111111111" _
& "1111111111111111111111111111111111111111111111111" _
& "1111111111111111111111111111111111111111111111111" _
& "1111111111111111111111111111111111111111111111111" _
& "and on and on and on"
oRng.Collapse wdCollapseEnd
Wend
End With
End Sub
On Jan 29, 12:25 pm, "mike" <m...@xxxxx> wrote:Hi Greg,
I brought your example as a potential approach, while it works great, the
boss wants to use the Microsoft recommended approach instead of copying the
long string to the ClipBoard.
All that I am looking to do is Replace some text (a tag) with a long string.
It is the same premise as your example.
The question is how might one implement Selection.TypeText when the text
(tag) is found with the Range object?
Has anyone tried this? It is not Form Field specific. I say that because it
works great with Selection.Find, however there is an area in this program
that uses Range.Find.
The behavior that I observe is that when the Range object finds the text
tag, lets say it is the 3rd bookmark, half way through the document. An
execution of Selection.TypeText myLongString will write out the long string
at the top of the document.
> I am not certain that I understand what you are really trying to do,
> but you mention find, replace, and long strings. Perhaps this will > help:- Hide quoted text -- Show quoted text -
- Follow-Ups:
- Re: String too long...
- From: mike
- Re: String too long...
- References:
- String too long...
- From: mike
- Re: String too long...
- From: mike
- Re: String too long...
- From: Tony Jollans
- Re: String too long...
- From: mike
- Re: String too long...
- From: Tony Jollans
- Re: String too long...
- From: mike
- Re: String too long...
- From: Greg Maxey
- Re: String too long...
- From: mike
- Re: String too long...
- From: Greg Maxey
- String too long...
- Prev by Date: Re: Break external link's in Word
- Next by Date: Re: Break external link's in Word
- Previous by thread: Re: String too long...
- Next by thread: Re: String too long...
- Index(es):
Relevant Pages
|