Consulting

Results 1 to 20 of 25

Thread: Activedocument.Footnotes.Reference.Text

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #15
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,273
    Location
    Hi dorogoi,
    My intent is to convert an existing document's (created by a third party) foot/endnotes to regular text at the end of the document, maintaining the original reference marks precisely (i.e. superscript mark in-paragraph and at the beginning of the footnote text).
    For converting endnotes, you could use code like:
    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
    With minor changes, the code can process footnotes instead. Nonetheless, footnotes will be inserted at the end of the document - programatically inserting them at the foot of each page is problematic, especially because Word uses the current printer driver to work out where the automatic page breaks should occur. Change printers and you could end up with page breaks occuring in a different position.
    There is potential for foot/endnote marks to be interlaced, upper/lower case letters/roman numerals and numbers -- with manual edits (renumbering) as well.
    Provided you convert the footnotes and endnotes separately, the fact they're interspersed within the document shouldn't matter. A limitation of the above macro, though, is that it doesn't handle the different numbering schemes that usually entails - for whichever references require it, you would need to do a bit of post-processing on the reference numbers to convert them to, say, roman numerals. The fact the macro preserves the corresponding Style names makes this fairly easy to do. An alternative is to change the footnotes to endnotes before running the macro, then process them all as a single set. I do note, though, your desire not to do this.
    And all of the above does not take into account if there is a manually assigned value (i.e. maybe the original author skipped numbers 10 through 19 for some reason).
    With Word, that's not a problem - simply because any re-starts & skipped ranges will be ignored by the macro. Usually, you can only re-start on a Section by Section basis. Again, the macro could be modofied to process each Section independently and to put the notes at the end of the Section rather than at the end of the document. What you might need to deal with, though, is footnote/endnote cross-references. I suggest dealing with those by converting them to plain text (eg by selecting them and pressing Ctrl-Shift-F9) before running the above macro.
    Last edited by macropod; 03-30-2010 at 04:55 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
  •