MS Office Forum / Word / Programming / January 2007
String too long...
|
|
Thread rating:  |
mike - 26 Jan 2007 19:50 GMT Hello,
This example works for Selection.TypeText seems to work well even after a .Find & .Execute
http://support.microsoft.com/kb/181110
I am maintaing an application and am a bit new working with Word Objects.
I am in another section of code and am not been able to obtain the benefit of Selection.TypeText the code happens to be working with the Range object.
How might one go about implementing this if working with a Range.Find & Execute?
- Mike
Jezebel - 26 Jan 2007 23:53 GMT Perhaps you could get someone to translate your question into English for you, and post it again.
Hello,
This example works for Selection.TypeText seems to work well even after a .Find & .Execute
http://support.microsoft.com/kb/181110
I am maintaing an application and am a bit new working with Word Objects.
I am in another section of code and am not been able to obtain the benefit of Selection.TypeText the code happens to be working with the Range object.
How might one go about implementing this if working with a Range.Find & Execute?
- Mike
mike - 28 Jan 2007 18:28 GMT Awfully sorry, it had been a terribly long week, with lot's of time pressures. I wasn't able to proof-read the note and on second look it surely needed it. I'll Try again...
I am maintaining an application and am a bit new working with Word Objects.
The Microsoft example in the link provided below seems to work well as a solution for one particular section of the application that I am working on. I have implemented Selection.TypeText immediately after performing Selection.Find & .Execute, as an alternative to their Selection.GoTo bookmark example.
http://support.microsoft.com/kb/181110
I am now in another section of the code that I am maintaining and am not able to obtain the safety benefits of Selection.TypeText. That is this particular section of code happens to be working with the Range object, however I would like to apply the TypeText solution.
How might one go about implementing this Microsoft example, if working with the results of a Range.Find & Execute?
Something to the affect of...
If Range.Find then Selection.Idunno = Range.Idunno Selection.TypeText (String((256, "W")) End If
- Mike
Tony Jollans - 28 Jan 2007 18:52 GMT The KB article you refer to relates to FormFields but you don't say you are working with FormFields so I'm not entirely sure what you want but the equivalent of TypeText is simply ..
(range).Text = "this is what I want there"
 Signature Enjoy, Tony
Awfully sorry, it had been a terribly long week, with lot's of time pressures. I wasn't able to proof-read the note and on second look it surely needed it. I'll Try again...
I am maintaining an application and am a bit new working with Word Objects.
The Microsoft example in the link provided below seems to work well as a solution for one particular section of the application that I am working on. I have implemented Selection.TypeText immediately after performing Selection.Find & .Execute, as an alternative to their Selection.GoTo bookmark example.
http://support.microsoft.com/kb/181110
I am now in another section of the code that I am maintaining and am not able to obtain the safety benefits of Selection.TypeText. That is this particular section of code happens to be working with the Range object, however I would like to apply the TypeText solution.
How might one go about implementing this Microsoft example, if working with the results of a Range.Find & Execute?
Something to the affect of...
If Range.Find then Selection.Idunno = Range.Idunno Selection.TypeText (String((256, "W")) End If
- Mike
mike - 29 Jan 2007 00:04 GMT Yes I understand that, thanks Tony.
Now if we wanted to make your code use a variable safely, then next step might be...
Dim myString As String myString = "this is what I want there"
If Len(myString) < 255 Then (range).Text = myString End If
If we want to expand on your example further, you might say we arrive at my question... How do we do the the Else?
If Not Len(myString) < 255 Then (range).Text = myString Else Selection.Idunno = (range).Idunno Selection.TypeText myString End If
Thanks again, - Mike
> The KB article you refer to relates to FormFields but you don't say you are > working with FormFields so I'm not entirely sure what you want but the [quoted text clipped - 32 lines] > > - Mike Tony Jollans - 29 Jan 2007 06:51 GMT All you need to do is:
(range).Select
But why do you want to use the Selection?
 Signature Enjoy, Tony
Yes I understand that, thanks Tony.
Now if we wanted to make your code use a variable safely, then next step might be...
Dim myString As String myString = "this is what I want there"
If Len(myString) < 255 Then (range).Text = myString End If
If we want to expand on your example further, you might say we arrive at my question... How do we do the the Else?
If Not Len(myString) < 255 Then (range).Text = myString Else Selection.Idunno = (range).Idunno Selection.TypeText myString End If
Thanks again, - Mike
> The KB article you refer to relates to FormFields but you don't say you > are [quoted text clipped - 37 lines] > > - Mike mike - 29 Jan 2007 14:22 GMT That doesn't appear to be the ticket but Thank you Tony.
It is harder to articulate the question!
> But why do you want to use the Selection? The objective is to go beyond the 255 character limitation of (range).Text. The same problem applies to (selection).Text
The recommended solution is in the MS KB article. I believe they're not saying you must use Form Fields. I believe the gist is that they're saying Selection.TypeText will accept and utilize an already allocated buffer. As opposed to copying a string into the .Text buffer that can only accept 255 characters.
>> http://support.microsoft.com/kb/181110 Using the Range object try to Find a Tag <myTag> and then replace the tag with a long string myLongString.
Tony Jollans - 29 Jan 2007 14:45 GMT There is not a general 255-character limit; it is only in certain circumstances. The KB article you refer to is saying that there is a 255-character limit putting text in formfields and shows one way to get round it. If you're not using Form Fields to start with, the article does not apply to you.
What exactly are you finding does not work? Can you post actual code?
 Signature Enjoy, Tony
> That doesn't appear to be the ticket but Thank you Tony. > [quoted text clipped - 15 lines] > Using the Range object try to Find a Tag <myTag> and then replace the tag > with a long string myLongString. mike - 29 Jan 2007 20:34 GMT This is where I had success...
MY.SYMPTONS Dim sData As String
Dim sDataInsertionTag As String
sData = String(256, "x")
sDataInsertionTag = "<Additional_Info>"
' Setup Find
Set oFindObject = objWord.Selection.Find
With oFindObject
.ClearFormatting
.Text = sDataInsertionTag
' Setup Replacement
With .Replacement
.Text = sData ' Run-time error 5854 "String parameter is too long"
End With
.Execute Replace:=wdReplaceOne, MatchCase:=True, Forward:=True
End With
Set oFindObject = Nothing
MY.WORKAROUND Dim sData As String
Dim sDataInsertionTag As String
sData = String(256, "x")
sDataInsertionTag = "<Additional_Info>"
' Setup Find
Set oFindObject = objWord.Selection.Find
With oFindObject
.ClearFormatting
.Text = sDataInsertionTag
' Setup Replacement
If .Execute(MatchCase:=True, Forward:=True) Then
objWord.Selection.TypeText sData
End If
End With
Set oFindObject = Nothing
Greg Maxey - 29 Jan 2007 21:02 GMT With the exception of your use of the string funciton which I didn't think of, your work around solutions looks very similiar to my last post:
Sub Test1() Dim oRng As Word.Range Set oRng = ActiveDocument.Range With oRng.Find .Text = "<Additional_Info>" While .Execute oRng.Text = String(256, "1") oRng.Collapse wdCollapseEnd Wend End With End Sub
Why do you want to to use Selection instead of range?
> This is where I had success... > [quoted text clipped - 61 lines] > > Set oFindObject = Nothing mike - 29 Jan 2007 21:34 GMT Because is resolves the 'Run-time error 5854 "String parameter is too long"
> With the exception of your use of the string funciton which I didn't > think of, your work around solutions looks very similiar to my last [quoted text clipped - 81 lines] >> >> Set oFindObject = Nothing mike - 29 Jan 2007 20:53 GMT This is where I am having a problem
MY.SYMPTONS Dim sData As String
Dim sDataInsertionTag As String
sData = String(256, "x")
sDataInsertionTag = "<Additional_Info>"
' Setup Find
Set oFindObject = objWord.Selection.Range.Find
With oFindObject
.ClearFormatting
.Text = sDataInsertionTag
' Setup Replacement
With .Replacement
.Text = sData ' Run-time error 5854 "String parameter is too long"
End With
.Execute Replace:=wdReplaceOne, MatchCase:=True, Forward:=True
End With
Set oFindObject = Nothing
MY.NEEDED.WORKAROUND Dim sData As String
Dim sDataInsertionTag As String
sData = String(256, "x")
sDataInsertionTag = "<Additional_Info>"
' Setup Find
Set oFindObject = objWord.Selection.Range.Find
With oFindObject
.ClearFormatting
.Text = sDataInsertionTag
' Setup Replacement
If .Execute(MatchCase:=True, Forward:=True) Then
objWord.Selection.Select ' Ineffective
objWord.Selection.Range.Select ' Ineffective as well
objWord.Selection.TypeText sData
End If
End With
Set oFindObject = Nothing
Greg Maxey - 29 Jan 2007 14:49 GMT Mike,
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:
http://gregmaxey.mvps.org/Find_Long_String.htm
> That doesn't appear to be the ticket but Thank you Tony. > [quoted text clipped - 11 lines] > >>http://support.microsoft.com/kb/181110Using the Range object try to Find a Tag <myTag> and then replace the tag > with a long string myLongString. mike - 29 Jan 2007 17:25 GMT 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: Greg Maxey - 29 Jan 2007 17:50 GMT 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
> Hi Greg, > [quoted text clipped - 19 lines] > > 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 - mike - 29 Jan 2007 22:01 GMT 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.
>I wouldn't think one would want to implement slection.typetext when > working with a range. Seems one would use range.text = whatever the [quoted text clipped - 48 lines] >> > 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 - Greg Maxey - 29 Jan 2007 22:53 GMT 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.
 Signature Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word.
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@mvps.org> wrote in message news:1170093004.695834.207920@k78g2000cwa.googlegroups.com... >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 > > > > >> 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 - >
mike - 29 Jan 2007 23:45 GMT 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! 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@m.com> wrote in message news:%23tEGBE$QHHA.920@TK2MSFTNGP05.phx.gbl... 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@mvps.org> wrote in message news:1170093004.695834.207920@k78g2000cwa.googlegroups.com... >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...@m.com> 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 - >
Tony Jollans - 30 Jan 2007 11:51 GMT > 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.
 Signature Enjoy, Tony
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! 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.
 Signature Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word.
"mike" <m@m.com> wrote in message news:%23tEGBE$QHHA.920@TK2MSFTNGP05.phx.gbl... 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.
>I wouldn't think one would want to implement slection.typetext when > working with a range. Seems one would use range.text = whatever the [quoted text clipped - 54 lines] >> > but you mention find, replace, and long strings. Perhaps this will >> > help:- Hide quoted text -- Show quoted text - mike - 30 Jan 2007 14:41 GMT Hi Tony, thanks for your interest,
> Please post code that is failing and indicate where.
> There is not a general 255-character limit; it is only in certain > circumstances. The KB article you refer to is saying that there is a > 255-character limit putting text in formfields and shows one way to get > round it. If you're not using Form Fields to start with, the article does > not apply to you. > What exactly are you finding does not work? Can you post actual code?
There is a reply with two separate posts to your message with sample code (formatted similar to a Microsoft KB) I am not sure if you don't see them for some reason. If your News Reader goes directly to microsoft.public.word.vba.general you should.
> 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?
Yes, see my sample code that was sent replying to you. In the second posting, the one that implements Range.Find has two lines that have "ineffective" commented beside them.
> 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.
I didn't really wake up one day saying that "I need to use Selection." We're experiencing Run-time error '5854' "String parameter is too long" when placing long text into both Selection.Find.Replacement.Text and Range.Find.Replacement.Text. So I began an investigation.
One stop, of many, was at a MS KB article recommeding Selection, because it offers TypeText. I found this solution "also" works splended after a Selection.Find, see the first sample code posting that employs Selection.Find.
While Greg has kindly provided a solution that implements the Clipboard for the Range.Find.Replacement, it does require the overhead of copying the long string to the Clipboard. Additionally it has the associated vulnerablities and impositions of using the user's Clipboard.
When compared to a Microsoft workaround that employs Selection.Typext, a routine that basically takes the actual buffer as input, and was proven to work with Selection.Find, the Microsoft workaround offers a definate architectual advantage.
And finally with this application's implementation, while the document is being generated, it is not yet ".Visible" to the user.
So that brought me to the question...
> I am in another section of code and am not been able to obtain the benefit of Selection.TypeText > the code happens to be working with the Range object.
> How might one go about implementing this if working with a Range.Find & Execute? Greg Maxey - 30 Jan 2007 14:59 GMT My understanding is you had a problem finding a tag and replacing it with a long sting (>255 characters).
I think we agree that this will solve that problem without using the users clipboard:
Sub Test1() Dim oRng As Word.Range Set oRng = ActiveDocument.Range With oRng.Find .Text = "<Additional_Info>" While .Execute oRng.Text = String(256, "1") oRng.Collapse wdCollapseEnd Wend End With End Sub
Other than theorectical debate about greater or lesser solutions, what answer or other information are you looking for in this discussion?
> Hi Tony, thanks for your interest, > [quoted text clipped - 36 lines] > > the code happens to be working with the Range object. > > How might one go about implementing this if working with a Range.Find & Execute?- Hide quoted text -- Show quoted text - mike - 30 Jan 2007 16:23 GMT While I don't think Jezabel would agree. If you now go back to my very first posting, the question remains...
> My understanding is you had a problem finding a tag and replacing it > with a long sting (>255 characters). [quoted text clipped - 88 lines] >> > How might one go about implementing this if working with a Range.Find & >> > Execute?- Hide quoted text -- Show quoted text - Greg Maxey - 30 Jan 2007 20:48 GMT Mike,
I cobbled together the following to show that you could employ selection.typetext to do the job.
I still don't know why you would want to chop wood with a dull axe.
Sub ScratchMacro() Dim oRng As Word.Range Set oRng = ActiveDocument.Range With oRng.Find .Text = "<myTag>" While .Execute Selection.Start = oRng.Start Selection.End = oRng.End Selection.Delete Selection.TypeText (String(256, "W")) oRng.Collapse wdCollapseEnd Wend End With End Sub
mike - 31 Jan 2007 13:51 GMT So that's how, huh..
Nice...
Kind of like the Australian fellows Super Range.
You guys are Super with your perseverance!
It is standard protocol for investigations. Typically, research two to three commendable solutions, develop a $ costing for each, provide pro's and con's for each. My overall campaign for this application's overhaul is Performance Tuning, it is expected that a selection (no pun) be brought to the bench. There is where I have profiling tools that'll highlight the performers.
FWIW, my background is 20 years IBM/Intel Assembler and C/C++. Please allow me to attempt to reciprocate your most excellent efforts if ever the need!
Thanks again Greg, sincerely,
- Mike
> Mike, > [quoted text clipped - 17 lines] > End With > End Sub
|
|
|