Chapter Number In Endnotes

K

kgee

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
 
D

Doug Robbins - Word MVP

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


--
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
 
K

kgee

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

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

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

kgee said:
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
 
D

Doug Robbins - Word MVP

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


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

kgee said:
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

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

--
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"
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
 

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