The code below should create a new document field and remove its code
text. However, in Word 2000 and XP, if the range of the new field
happens to occur inside a table which has its "Text Wrapping" property
set to "Around", the text "T " is always left behind in the field. In
fact, any assignment to the field code's "Text" property appends "T "
to the end of the text assigned.
Has anyone seen this apparent bug before? Does anyone have a solid
workaround? The only workaround I've found is to call "Delete" on the
field's code before assigning a value to its "Text" property.
Thanks.
Anne Troy - 24 Oct 2005 15:05 GMT
Chris: You forgot to post your code. :)
************
Anne Troy
www.OfficeArticles.com
> The code below should create a new document field and remove its code
> text. However, in Word 2000 and XP, if the range of the new field
[quoted text clipped - 8 lines]
>
> Thanks.
Chris Peacock - 24 Oct 2005 16:02 GMT
Oops!!! Thanks. Here goes....
Sub Test()
Dim field As field
Dim rangeField As range
Dim table As table
Set table = Tables(1)
Set rangeField = range(0, 0)
Set field = Fields.Add(rangeField)
field.Code.Text = ""
End Sub