Results 1 to 20 of 25

Thread: Activedocument.Footnotes.Reference.Text

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #16
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,273
    Location
    Hi dorogoi,

    Here's an enhanced version of the macro, that faithfully replicates the referencing type (eg roman numerals):
    Sub UnLinkEndNotes()
    Application.ScreenUpdating = False
    Dim eRng As Range, eNote As Endnote, eRef As String
    With ActiveDocument
      For Each eNote In .Endnotes
        With eNote
          With .Reference.Characters.First
            .Collapse
            .InsertCrossReference wdRefTypeEndnote, wdEndnoteNumberFormatted, eNote.Index
            eRef = .Characters.First.Fields(1).Result
            .Characters.First.Fields(1).Unlink
          End With
          .Range.Cut
        End With
        Set eRng = .Range
        With eRng
          .InsertAfter vbCr & eRef & " - "
          .Start = .End
          .Paste
          .Style = "Endnote Text"
        End With
      Next
      For Each eNote In .Endnotes
        eNote.Delete
      Next
    End With
    Set eRng = Nothing
    Application.ScreenUpdating = True
    End Sub
    To get the reference type, I (simply?) inserted a cross-reference to the endnote and captured the cross-reference text before unlinking it.
    Last edited by macropod; 03-30-2010 at 05:06 PM.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •