G
Greg Maxey
Russ,
Really I don't know. I just saw what he was doing with his code and assumed
he had a reason for them.
Good point on LBound. I like Split as it means typing less double quotes
when I write the code ;-)
--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
You're right. Does Jerem really need to insert fields?
Really I don't know. I just saw what he was doing with his code and assumed
he had a reason for them.
Good point on LBound. I like Split as it means typing less double quotes
when I write the code ;-)
--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
Greg,
You're right. Does Jerem really need to insert fields?
What advantage does he gain by inserting fields?
Your code should be faster, if there are less lines of code to
process. In my MacWord, I don't have the built-in commands of the
newer versions.
Greg, another thing I noticed in your code.
I'm now under the impression that it would better most times to use:
For i = LBound(myArray) To UBound(myArray)
...not knowing how a potential users Option Base is set up.
Ed,
Yes I think I would do it something like that myself if the jerem
doesn't want the AutoText fields. That is if I would have
remembered InsertAutoText without seeing your code ;-)
I still think I would use the array though instead of having all of
the routines and passing variables:
Sub ScrathMacroII()
Dim myArray As Variant
Dim i As Long
Dim oRng As Word.Range
myArray = Split("[A]|", "|") '[C] etc.
For i = 0 To UBound(myArray)
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = myArray(i)
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
While .Execute
oRng.InsertAutoText
oRng.Collapse wdCollapseEnd
Wend
End With
Next i
End Sub