endnotes

J

Jamie

I often need to take endnotes out of Word's endnote
function and turn them into superscript numbers within the
text and a list at the end of the document. The only
method I know of is copy the endnote text into another
document and number each entry, then go through the
original document deleting endnote references and entering
superscript numbers. Does any one know of an easier way of
doing this? (I can't have any cross-referencing, fields or
automatic numbering in the result. Everything has to be
straight text.)
 
D

Doug Robbins - Word MVP

Hi Jamie,

The following macro will convert endnotes to ordinary text in the way that
you want:

' Macro created 29/09/99 by Doug Robbins to replace endnotes with textnotes
at end of document
' to replace the endnote reference in the body of the document with a
superscript number.
'
Dim aendnote As Endnote
For Each aendnote In ActiveDocument.Endnotes
ActiveDocument.Range.InsertAfter vbCr & aendnote.Index & vbTab &
aendnote.Range
aendnote.Reference.InsertBefore "a" & aendnote.Index & "a"
Next aendnote
For Each aendnote In ActiveDocument.Endnotes
aendnote.Reference.Delete
Next aendnote
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find.Replacement.Font
.Superscript = True
End With
With Selection.Find
.Text = "(a)([0-9]{1,})(a)"
.Replacement.Text = "\2"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
J

Jamie

Doug,

Thanks! that will be a big time save.

I am wondering if the code can be changed so that the
numbers of the endnotes at the end are supercript and with
a space instead of a tab? I am trying to learn visual
basic, but it is slow going. If you could point me in the
right direction to make the above adjustments I would
appreciate it.

Thanks,

Jamie
-----Original Message-----
Hi Jamie,

The following macro will convert endnotes to ordinary text in the way that
you want:

' Macro created 29/09/99 by Doug Robbins to replace endnotes with textnotes
at end of document
' to replace the endnote reference in the body of the document with a
superscript number.
'
Dim aendnote As Endnote
For Each aendnote In ActiveDocument.Endnotes
ActiveDocument.Range.InsertAfter vbCr & aendnote.Index & vbTab &
aendnote.Range
aendnote.Reference.InsertBefore "a" & aendnote.Index & "a"
Next aendnote
For Each aendnote In ActiveDocument.Endnotes
aendnote.Reference.Delete
Next aendnote
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find.Replacement.Font
.Superscript = True
End With
With Selection.Find
.Text = "(a)([0-9]{1,})(a)"
.Replacement.Text = "\2"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
I often need to take endnotes out of Word's endnote
function and turn them into superscript numbers within the
text and a list at the end of the document. The only
method I know of is copy the endnote text into another
document and number each entry, then go through the
original document deleting endnote references and entering
superscript numbers. Does any one know of an easier way of
doing this? (I can't have any cross-referencing, fields or
automatic numbering in the result. Everything has to be
straight text.)


.
 
D

Doug Robbins - Word MVP

Hi Jamie, the space is easy, replace

ActiveDocument.Range.InsertAfter vbCr & aendnote.Index & vbTab &
aendnote.Range

with

ActiveDocument.Range.InsertAfter vbCr & aendnote.Index & vbSpace &
aendnote.Range

and I think (it's untested) that if you follow that with

ActiveDocument.Paragraphs(Last).Range.Words(1).Font.Superscript = True

it will superscript the number.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
Jamie said:
Doug,

Thanks! that will be a big time save.

I am wondering if the code can be changed so that the
numbers of the endnotes at the end are supercript and with
a space instead of a tab? I am trying to learn visual
basic, but it is slow going. If you could point me in the
right direction to make the above adjustments I would
appreciate it.

Thanks,

Jamie
-----Original Message-----
Hi Jamie,

The following macro will convert endnotes to ordinary text in the way that
you want:

' Macro created 29/09/99 by Doug Robbins to replace endnotes with textnotes
at end of document
' to replace the endnote reference in the body of the document with a
superscript number.
'
Dim aendnote As Endnote
For Each aendnote In ActiveDocument.Endnotes
ActiveDocument.Range.InsertAfter vbCr & aendnote.Index & vbTab &
aendnote.Range
aendnote.Reference.InsertBefore "a" & aendnote.Index & "a"
Next aendnote
For Each aendnote In ActiveDocument.Endnotes
aendnote.Reference.Delete
Next aendnote
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find.Replacement.Font
.Superscript = True
End With
With Selection.Find
.Text = "(a)([0-9]{1,})(a)"
.Replacement.Text = "\2"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
I often need to take endnotes out of Word's endnote
function and turn them into superscript numbers within the
text and a list at the end of the document. The only
method I know of is copy the endnote text into another
document and number each entry, then go through the
original document deleting endnote references and entering
superscript numbers. Does any one know of an easier way of
doing this? (I can't have any cross-referencing, fields or
automatic numbering in the result. Everything has to be
straight text.)


.
 

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