Yes you can omit those. Simpler still is to use a loop, with the changing
values in variables --
With Selection.Find
For i = 1 to 14
.Text = Choose(i, "del^13", "...", "..."....)
.Replacement.Text = Choose(i,"delivery^p", "...", "......)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
Next
End with
Thanks! If I do it this way, how many entries can I have in
Text = Choose(i, "..", "...", "..."....)
and
Replacement Text = Choose(i, "..", "...", "..."....)
?
I am up to 256 terms now, with a probable upper limit of 500.
And what is the function of the
For i = 1 to 14
statement?
Appreciate all the help!
> Yes you can omit those. Simpler still is to use a loop, with the changing
> values in variables --
[quoted text clipped - 46 lines]
> > at
> > most just have to keep the .Wrap statement?
Jezebel - 11 Feb 2006 03:29 GMT
I don't know what the technical limit is for choose() -- but for more than
about a dozen items (as you have), it's impractical: it's too hard to see
what's going on with your code.
In your case, it would be better to set up an array --
Dim pText(1 to n, 1 to 2) as string
pText(1,1) = "del^p" : pText(1,2) = "delivery^p"
:
With as many items as you have, you might want to set this up in a table or
a spreadsheet, where it's easier to maintain.
For i = 1 to n
.Text = pText(i,1)
.Replacement.Text = pText(i,2)
:
The i = 1 to 14 was my misreading of your question. I thought you had 14
replacements to do.
> Thanks! If I do it this way, how many entries can I have in
>
[quoted text clipped - 65 lines]
>> > at
>> > most just have to keep the .Wrap statement?