Formatting in endnote to text macro?

D

David Clough

I've just come across a Word macro Doug Robbins posted on Google Groups
some time back to convert endnotes to text (below). I'm grateful for
this, which will be useful as I and a co-author have a lot of endnotes
to convert before submitting a book.

When I run it, however, I lose all the formatting in my endnotes, which
is a problem for all the italicized book titles in my notes. Is there
any way to retain this formatting?

Thanks for any help you can provide.

Yours,

David.
--
From:

Doug Robbins- view profile
<http://groups.google.com/groups/profile?enc_user=n5ytSBIAAADLukhUwkIQqTf
lNRzxM-TQII73Nnd8MGuFrQYThHx-nw>
Date:

Wed, Jan 19 2005 3:41am
Email:

"Doug Robbins" <d...
<http://groups.google.com/groups/unlock?msg=a80683a23dc18ad5&_done=/group
/microsoft.public.word.formatting.longdocs/browse_frm/thread/e186d433d465
8f5/a80683a23dc18ad5%2523a80683a23dc18ad5%3F> @NOmvpsSPAM.org>
Groups:

microsoft.public.word.formatting.longdocs


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

Doug Robbins - Word MVP

The following modified code should preserve the formatting:

Dim aendnote As Endnote
For Each aendnote In ActiveDocument.Endnotes
ActiveDocument.Range.InsertAfter vbCr & aendnote.Index & vbTab &
aendnote.Range.FormattedText
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

David Clough said:
I've just come across a Word macro Doug Robbins posted on Google Groups
some time back to convert endnotes to text (below). I'm grateful for
this, which will be useful as I and a co-author have a lot of endnotes
to convert before submitting a book.

When I run it, however, I lose all the formatting in my endnotes, which
is a problem for all the italicized book titles in my notes. Is there
any way to retain this formatting?

Thanks for any help you can provide.

Yours,

David.
--
From:

Doug Robbins- view profile
<http://groups.google.com/groups/profile?enc_user=n5ytSBIAAADLukhUwkIQqTf
lNRzxM-TQII73Nnd8MGuFrQYThHx-nw>
Date:

Wed, Jan 19 2005 3:41am
Email:

"Doug Robbins" <d...
<http://groups.google.com/groups/unlock?msg=a80683a23dc18ad5&_done=/group
/microsoft.public.word.formatting.longdocs/browse_frm/thread/e186d433d465
8f5/a80683a23dc18ad5%2523a80683a23dc18ad5%3F> @NOmvpsSPAM.org>
Groups:

microsoft.public.word.formatting.longdocs


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

David Clough

Dear Doug,

many thanks for this rapid response. I'm not finding that the change
makes any difference, though: I'm still losing my italics for some
reason.

Yours,

David.

Doug Robbins - Word MVP said:
The following modified code should preserve the formatting:

Dim aendnote As Endnote
For Each aendnote In ActiveDocument.Endnotes
ActiveDocument.Range.InsertAfter vbCr & aendnote.Index & vbTab &
aendnote.Range.FormattedText
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

David Clough said:
I've just come across a Word macro Doug Robbins posted on Google Groups
some time back to convert endnotes to text (below). I'm grateful for
this, which will be useful as I and a co-author have a lot of endnotes
to convert before submitting a book.

When I run it, however, I lose all the formatting in my endnotes, which
is a problem for all the italicized book titles in my notes. Is there
any way to retain this formatting?

Thanks for any help you can provide.

Yours,

David.
--
From:

Doug Robbins- view profile
<http://groups.google.com/groups/profile?enc_user=n5ytSBIAAADLukhUwkIQqTf
lNRzxM-TQII73Nnd8MGuFrQYThHx-nw>
Date:

Wed, Jan 19 2005 3:41am
Email:

"Doug Robbins" <d...
<http://groups.google.com/groups/unlock?msg=a80683a23dc18ad5&_done=/group
/microsoft.public.word.formatting.longdocs/browse_frm/thread/e186d433d465
8f5/a80683a23dc18ad5%2523a80683a23dc18ad5%3F> @NOmvpsSPAM.org>
Groups:

microsoft.public.word.formatting.longdocs


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

Doug Robbins - Word MVP

Hi David,

Seems like it is necessary to do it as follows:

Dim aendnote As Endnote
Dim arange As Range
Dim trange As Range
For Each aendnote In ActiveDocument.Endnotes
Set arange = aendnote.Range.FormattedText
arange.Copy
ActiveDocument.Range.InsertAfter vbCr
Set trange = ActiveDocument.Range
trange.Start = trange.End
trange.Paste
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

David Clough said:
Dear Doug,

many thanks for this rapid response. I'm not finding that the change
makes any difference, though: I'm still losing my italics for some
reason.

Yours,

David.

Doug Robbins - Word MVP said:
The following modified code should preserve the formatting:

Dim aendnote As Endnote
For Each aendnote In ActiveDocument.Endnotes
ActiveDocument.Range.InsertAfter vbCr & aendnote.Index & vbTab &
aendnote.Range.FormattedText
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

David Clough said:
I've just come across a Word macro Doug Robbins posted on Google Groups
some time back to convert endnotes to text (below). I'm grateful for
this, which will be useful as I and a co-author have a lot of endnotes
to convert before submitting a book.

When I run it, however, I lose all the formatting in my endnotes, which
is a problem for all the italicized book titles in my notes. Is there
any way to retain this formatting?

Thanks for any help you can provide.

Yours,

David.
--
From:

Doug Robbins- view profile
<http://groups.google.com/groups/profile?enc_user=n5ytSBIAAADLukhUwkIQqTf
lNRzxM-TQII73Nnd8MGuFrQYThHx-nw>
Date:

Wed, Jan 19 2005 3:41am
Email:

"Doug Robbins" <d...
<http://groups.google.com/groups/unlock?msg=a80683a23dc18ad5&_done=/group
/microsoft.public.word.formatting.longdocs/browse_frm/thread/e186d433d465
8f5/a80683a23dc18ad5%2523a80683a23dc18ad5%3F> @NOmvpsSPAM.org>
Groups:

microsoft.public.word.formatting.longdocs


' 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
 

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