Range.InsertAfter conserve formattting

B

burrowing owl

Hello,

Should I expect "ActiveDocument.Range.InsertAfter Endnote.Range" to
conserve the formatting from the endnote, specifically italics or
underlining? It seems to remove it. If it is in fact removing
formatting, is there a command that would tell it to conserve
formatting?

Just a portion of a script to un-embed endnotes (see line 3):

1 Dim aendnote As Endnote
2 For Each aendnote In ActiveDocument.Endnotes
3 ActiveDocument.Range.InsertAfter vbCr & aendnote.Index & "-" &
aendnote.Range
4 aendnote.Reference.InsertBefore "a" & aendnote.Index & "a"
5 Next aendnote
6 For Each aendnote In ActiveDocument.Endnotes
7 aendnote.Reference.Delete
8 Next aendnote
 
M

macropod

Hi burrowing owl,

If you want to preserve the endnote text formatting, cut & paste the endnote text.
 
M

macropod

PS:

You might want to try something along the lines of:
Sub UnLinkEndNotes()
Dim eRng As Range, eNote As Endnote, i As Integer
With ActiveDocument
For Each eNote In .Endnotes
With eNote
i = .Index
With .Reference.Characters.Last
.InsertBefore i
.Style = "Endnote Reference"
End With
.Range.Cut
End With
Set eRng = .Range
With eRng
.InsertAfter vbCr & i & " - "
.Start = .End
.Paste
.Style = "Endnote Text"
End With
Next
For Each eNote In .Endnotes
eNote.Delete
Next
End With
End Sub


--
Cheers
macropod
[Microsoft MVP - Word]


macropod said:
Hi burrowing owl,

If you want to preserve the endnote text formatting, cut & paste the endnote text.

--
Cheers
macropod
[Microsoft MVP - Word]


burrowing owl said:
Hello,

Should I expect "ActiveDocument.Range.InsertAfter Endnote.Range" to
conserve the formatting from the endnote, specifically italics or
underlining? It seems to remove it. If it is in fact removing
formatting, is there a command that would tell it to conserve
formatting?

Just a portion of a script to un-embed endnotes (see line 3):

1 Dim aendnote As Endnote
2 For Each aendnote In ActiveDocument.Endnotes
3 ActiveDocument.Range.InsertAfter vbCr & aendnote.Index & "-" &
aendnote.Range
4 aendnote.Reference.InsertBefore "a" & aendnote.Index & "a"
5 Next aendnote
6 For Each aendnote In ActiveDocument.Endnotes
7 aendnote.Reference.Delete
8 Next aendnote
 
B

burrowing owl

Thank you so much, macropod!
In good epistolary form, you saved the best part for the PS.
 

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