Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Nov 2003
    Posts
    52
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Need to remove extra returns at the end of a footnote

    For some reason the files I get from my editors always have extra returns at the end each and every footnote. Is there a quick way to remove those with VBA?

    Thanks in advance for all your help.

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Willow Grove, Pennsylvania, USA
    Posts
    196
    Thanks
    4
    Thanked 46 Times in 38 Posts
    You didn't mention endnotes, but they work the same way so I threw them in.

    Code:
    Sub CleanFootnotesAndEndnotes()
        Dim fn As Footnote
        Dim en As Endnote
        Dim rg As Range
        
        For Each fn In ActiveDocument.Footnotes
            Set rg = fn.Range
            rg.Start = fn.Range.End - 1
            While rg.Text = vbCr
                rg.Delete
                rg.Start = fn.Range.End - 1
            Wend
        Next
        
        For Each en In ActiveDocument.Endnotes
            Set rg = en.Range
            rg.Start = en.Range.End - 1
            While rg.Text = vbCr
                rg.Delete
                rg.Start = en.Range.End - 1
            Wend
        Next
    End Sub
    Last edited by jjfreedman; 2011-10-03 at 12:49.

Posting Permissions

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