There is one other thing. These table of authority codes also exist in the
footnotes and the suggested coding only looks at the main document. Is there
a way to read the TA field codes located in the footnotes as well?
Yes, this will catch TA fields in footnotes, endnotes, and anywhere
else you were able to stick them:
Sub Demo()
Dim oRg As Range
Dim fld As Field
Dim fcode As String
Dim codeParts As Variant
Dim i As Integer
Dim partType As String
Dim part As String
Dim lparam As String
Dim sparam As String
Dim cparam As String
For Each oRg In ActiveDocument.StoryRanges
Do
For Each fld In oRg.Fields
'check only the TA fields
If fld.Type = wdFieldTOAEntry Then
' get the field code in a string variable
fcode = fld.Code
' make an array of the code parts
codeParts = Split(fcode, "\")
' codeParts(0) contains the TA keyword
'which can be ignored
For i = 1 To UBound(codeParts)
' get the letter that followed the slash
partType = LCase(Left(codeParts(i), 1))
'get the rest of the part and
'remove the quotes and spaces at the ends
part = codeParts(i)
part = Right(part, Len(part) - 2)
part = Trim(Replace(part, """", ""))
'put the result in the proper bin
'(replace these with assignments to
'.Text property of the text boxes)
Select Case partType
Case "l"
lparam = part
Case "s"
sparam = part
Case "c"
cparam = part
Case Else
End Select
Next
'just so you can see the results for this demo
MsgBox "Longcitation: " & lparam & vbCr & _
"Shortcitation: " & sparam & vbCr & _
"Category: " & cparam
End If
Next fld
Set oRg = oRg.NextStoryRange
Loop Until oRg Is Nothing
Next oRg
End Sub
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
>There is one other thing. These table of authority codes also exist in the
>footnotes and the suggested coding only looks at the main document. Is there
[quoted text clipped - 90 lines]
>> >
>> >Any help is greatly appreciated thanks. :D
frank - 05 Apr 2007 02:00 GMT
ohhh man, that's perfect. God, I love beautifully written code. I know this
stuff is probably nothing to guys like you, but to a novice like me it reads
like poetry. It makes the dialog box I created work so smoothly.
Thanks again for everything.
> Yes, this will catch TA fields in footnotes, endnotes, and anywhere
> else you were able to stick them:
[quoted text clipped - 160 lines]
> >> >
> >> >Any help is greatly appreciated thanks. :D
Jay Freedman - 05 Apr 2007 14:33 GMT
> ohhh man, that's perfect. God, I love beautifully written code. I
> know this stuff is probably nothing to guys like you, but to a novice
> like me it reads like poetry. It makes the dialog box I created work
> so smoothly.
>
> Thanks again for everything.
Thank you for the compliment. :-)

Signature
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.