I have been asked if there is a way to remove automatically the {TA...} codes from the document. In other words, they want to leave in the cites, but remove the codes.
Try the following code it will delete ALL TA/TOA fields from a document.
Sub RemoveAllTOAFields()
Dim rngStory As Word.Range
Dim fldTemp As Word.Field
Dim lngIndex As Long
' Iterate through all story types
For Each rngStory In ActiveDocument.StoryRanges
Do Until rngStory Is Nothing
' This must be done backwards as we are using the fields
' index and deleteing fields from the same collection at
' the same time
For lngIndex = rngStory.Fields.Count To 1 Step -1
Set fldTemp = rngStory.Fields(lngIndex)
If fldTemp.Type = wdFieldTOA Or _
fldTemp.Type = wdFieldTOAEntry Then
fldTemp.Delete
End If
Next
' There may be linked stories so make sure we get them as well
Set rngStory = rngStory.NextStoryRange
Loop
Next
End Sub
HTH + Cheers - Peter
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.