> On 1/2/08 2:28 PM, "Tavares[ajtavares ipca.pt]" wrote:
> I need to create an index of authors in my thesis I'm
using EndnoteX
> Is there a way to generate the index of authors
referenced in my
> thesis?
> Thanks,
> Tavares
Are you saying you want a list of authors with the page
numbers that
they appear on? If so, the easiest way would be to use
Word's inbuilt
index feature. Basically, you go through your document,
putting in
'index marks'
wherever an author appears, and then go to the end and
insert the index.
Word's help file is pretty good on this one.
It's actually not difficult to write a script to do this...
as the
cooking show hosts say, "here's one I prepared
earlier".
CAVEATS:
- I'm not necessarily going to support this code.
- this was written on a pc, and probably won't work on a
mac.
- this works in Word 2003, will probably work in word 2000,
but
WILL NOT work in Word 97.
- this works with EN version 9, and I have absolutely no
idea if
it is even remotely compatible with later versions of
Endnote. (Please
do let me know!)
- each time you run this code it will create an extra set
of
index entries.
- It creates one index entry per author, and the formatting
is
AS ENTERED INTO ENDNOTE (complete with double commas, etc.),
NOT as
formatted by your output style.
INSTRUCTIONS:
1. Go into your document in Word. Press Alt+F11 to take you
to Visual
Basic.
2. From the 'Insert' menu, choose 'Module'. (A blank window
should
appear) 3. Copy and paste in the code which follows these
instructions
4. Click with the mouse to put your cursor somewhere in this
code.
5. Press F5. The window title should have a [running] in it
for some
seconds which will then go away. Voila: you have index
entries.
6. Press Alt+F4 and return to Word. Move to where you want
your index.
7. From the Insert menu, choose 'Reference', then 'Indexes
and tables'
8. The 'index' tab (which you want) should be the default.
Press ok.
'-----------------------------------------------------------
----------
' Index Entries from Endnote Addin Fields ' (c) Michael
Power, 2008.
Feel free to use/modify with acknowledgemnt
'-----------------------------------------------------------
----------
Sub generate_index_entries()
Dim AuthorsString As String, Authors() As String, startpos
As Integer
Dim endpos As Integer, itm As Integer
'document text
For Each currentfield In ThisDocument.Fields
If Left(Trim(currentfield.Code), 13) = "ADDIN
EN.CITE" Then
startpos = InStr(InStr(currentfield.Code,
"<record>"), _
currentfield.Code, "<authors>") + 17
If startpos > 17 Then
endpos = InStr(InStr(currentfield.Code,
"<record>"), _
currentfield.Code, "</authors>") -
1
AuthorsString = Replace(Mid(currentfield.Code,
startpos, _
(endpos - startpos) + 1),
"</author>", "")
Authors = Split(AuthorsString,
"<author>")
currentfield.Select
Selection.Collapse
For itm = 0 To UBound(Authors)
ThisDocument.Fields.Add Selection.Range, _
wdFieldIndexEntry, """"
& Authors(itm) & """"
Next
End If
End If
Next
'footnotes
For Each currentnote In ThisDocument.Footnotes
For Each currentfield In currentnote.Range.Fields
If Left(Trim(currentfield.Code), 13) = "ADDIN
EN.CITE" Then
startpos = InStr(InStr(currentfield.Code,
"<record>"), _
currentfield.Code, "<authors>") +
17
If startpos > 17 Then
endpos = InStr(InStr(currentfield.Code,
"<record>"), _
currentfield.Code, "</authors>")
- 1
AuthorsString = Replace(Mid(currentfield.Code,
startpos, _
(endpos - startpos) + 1),
"</author>", "")
Authors = Split(AuthorsString,
"<author>")
currentfield.Select
Selection.Collapse
For itm = 0 To UBound(Authors)
ThisDocument.Fields.Add Selection.Range, _
wdFieldIndexEntry, """"
& Authors(itm) & """"
Next
End If
End If
Next
Next
'endnotes
For Each currentnote In ThisDocument.Endnotes
For Each currentfield In currentnote.Range.Fields
If Left(Trim(currentfield.Code), 13) = "ADDIN
EN.CITE" Then
startpos = InStr(InStr(currentfield.Code,
"<record>"), _
currentfield.Code, "<authors>") +
17
If startpos > 17 Then
endpos = InStr(InStr(currentfield.Code,
"<record>"), _
currentfield.Code, "</authors>")
- 1
AuthorsString = Replace(Mid(currentfield.Code,
startpos, _
(endpos - startpos) + 1),
"</author>", "")
Authors = Split(AuthorsString,
"<author>")
currentfield.Select
Selection.Collapse
For itm = 0 To UBound(Authors)
ThisDocument.Fields.Add Selection.Range, _
wdFieldIndexEntry, """"
& Authors(itm) & """"
Next
End If
End If
Next
Next
MsgBox "Finished adding index entries", ,
"Processing Complete"
End Sub
|