Deleting TOA codes from the document

E

Edna Griffith

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.
 
G

Greg Maxey

Edna,

I may be off the mark, but selecting a field code and using CTRL+SHIFT+F9
converts the field to fixed text. Is this what you are looking for?
 
S

Suzanne S. Barnhill

Display Hidden text, then search for ^19 TA and replace with nothing.



Edna Griffith said:
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.
 
P

Peter Hewett

Hi ?

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.

Ask a Question

Top