Results 1 to 7 of 7

Thread: Converting glossary to footnotes

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,273
    Location
    A Word macro to do as you describe is:
    Sub Demo()
    Application.ScreenUpdating = False
    Dim Tbl As Table, StrFnd As String, Rng As Range, FtNt As Footnote, r As Long
    With ActiveDocument
      Set Tbl = .Tables(.Tables.Count)
      Tbl.Range.Style = wdStyleFootnoteText
      For r = 1 To Tbl.Rows.Count
        Set Rng = Tbl.Cell(r, 2).Range
        Rng.End = Rng.End - 1
        StrFnd = Trim(Split(Tbl.Cell(r, 1).Range.Text, vbCr)(0))
        With .Range
          With .Find
            .ClearFormatting
            .Replacement.ClearFormatting
            .Format = False
            .Text = StrFnd
            .Wrap = wdFindStop
            .MatchWholeWord = True
            .MatchWildcards = False
            .MatchCase = True
            .Execute
          End With
          .Collapse wdCollapseEnd
          Set FtNt = .Footnotes.Add(Range:=.Duplicate)
          With FtNt.Range
            .FormattedText = Rng.FormattedText
            .CollapsewdCollapseStart
            .Text = StrFnd & ": "
            .Style = wdStyleStrong
          End With
        End With
      Next
      Tbl.Delete
    End With
    Application.ScreenUpdating = True
    End Sub
    Last edited by macropod; 06-10-2021 at 03:27 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
  •