Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 01-09-2022, 06:07 PM
macropod's Avatar
macropod macropod is offline Converting hyperlinked endnotes to footnotes Windows 10 Converting hyperlinked endnotes to footnotes Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
 

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
Converting hyperlinked endnotes to footnotes 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 hyperlinked endnotes to footnotes Converting hard-entered endnotes to footnotes? New Daddy Word VBA 1 10-21-2012 02:51 PM
Converting hyperlinked endnotes to footnotes Endnotes within Footnotes? elias Word 12 09-04-2012 04:12 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:36 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft