Does anyone know how to include the Chapter Number in the endnotes?
Similar to the way you can select the checkbox "Include Chapter Number"
for captions, but I do not see this option for my endnotes. I'd like
my endnotes to read 1-1, 1-2, 2-1, 2-2, etc. etc.
Also, I only want the chapter NUMBER, since my chapters are called
Chapter 1, Chapter 2, etc., I do not want to include the word Chapter
in the reference.
Thanks!
Kathy
Doug Robbins - Word MVP - 22 Dec 2006 07:06 GMT
The following is a modification of some code I created a while ago that
should do that. Don't use it until you are really finished with creating
the document, or run it on a copy of the document as it turns the end notes
into ordinary text and if you later add one, it will be treated as the first
end note in the document.
' 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
Dim refrange As Range
Dim i As Long
For Each aendnote In ActiveDocument.Endnotes
Set refrange = aendnote.Reference
refrange.Start = ActiveDocument.Range.Start
i = refrange.Sections.Count
ActiveDocument.Range.InsertAfter vbCr & i & " - " & 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

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Does anyone know how to include the Chapter Number in the endnotes?
> Similar to the way you can select the checkbox "Include Chapter Number"
[quoted text clipped - 7 lines]
> Thanks!
> Kathy
kgee - 22 Dec 2006 12:00 GMT
Thanks for the quick response. Does this also replace the footnote
reference in the text with a cross reference to the converted endnotes?
I had thought about that as a way to get the chapter numbers, but with
500+ endnotes, this macro will certainly come in handy!
Kathy
On Dec 22, 2:06 am, "Doug Robbins - Word MVP" <d...@REMOVECAPSmvps.org>
wrote:
> The following is a modification of some code I created a while ago that
> should do that. Don't use it until you are really finished with creating
[quoted text clipped - 55 lines]
> > Thanks!
> > Kathy
Doug Robbins - Word MVP - 23 Dec 2006 17:28 GMT
To get the chapter number in the end note reference, the code should be
modified to the following:
' 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
Dim refrange As Range
Dim i As Long
For Each aendnote In ActiveDocument.Endnotes
Set refrange = aendnote.Reference
refrange.Start = ActiveDocument.Range.Start
i = refrange.Sections.Count
ActiveDocument.Range.InsertAfter vbCr & i & " - " & aendnote.Index &
vbTab & aendnote.Range
aendnote.Reference.InsertBefore "a" & i & " - " & 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,} - [0-9]{1,})(a)"
.Replacement.Text = "\2"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Thanks for the quick response. Does this also replace the footnote
> reference in the text with a cross reference to the converted endnotes?
[quoted text clipped - 68 lines]
>> > Thanks!
>> > Kathy