![]() |
|
#6
|
||||
|
||||
|
Try the following code. Although you refer to footnotes, your content is more akin to endnotes - which is what the macro converts your content to.
Code:
Sub CreateEndNotes()
Application.ScreenUpdating = False
Dim Tbl As Table, r As Long, Hlnk As Hyperlink
Dim RngRef As Range, RngText As Range
With ActiveDocument
.Endnotes.NumberStyle = wdNoteNumberStyleArabic
Set Tbl = .Hyperlinks(.Hyperlinks.Count).Range.Tables(1)
If Tbl Is Nothing Then Exit Sub
With Tbl
For r = .Rows.Count To 1 Step -1
If .Cell(r, 1).Range.Hyperlinks.Count > 0 Then
Set Hlnk = .Cell(r, 1).Range.Hyperlinks(1)
Set RngText = Tbl.Cell(r, 2).Range
With RngText
.End = .End - 1
Do While .Characters.Last = vbCr
.End = .End - 1
Loop
End With
Set RngRef = ActiveDocument.Bookmarks(Hlnk.SubAddress).Range
With RngRef
.End = .Paragraphs(1).Range.End
.End = .Hyperlinks(1).Range.End
.Text = vbNullString
End With
ActiveDocument.Endnotes.Add RngRef
With RngRef
.End = .End + 1
.Endnotes(1).Range.FormattedText = RngText.FormattedText
End With
End If
Next
.Delete
End With
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
| Tags |
| footnotes, hyperlinks, vba |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Converting certain footnotes to endnotes | Brainiac | Word VBA | 3 | 07-02-2019 04:31 AM |
Footnotes / Endnotes? | See attachment
|
modene1 | Word | 2 | 05-17-2017 02:53 AM |
| Changing footnotes to endnotes | Sarah | Word | 3 | 04-27-2017 08:55 PM |
Converting hard-entered endnotes to footnotes?
|
New Daddy | Word VBA | 1 | 10-21-2012 02:51 PM |
Endnotes within Footnotes?
|
elias | Word | 12 | 09-04-2012 04:12 PM |