2011-10-03, 09:33 #1
- Join Date
- Nov 2003
- 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.
Subscribe to our Windows Secrets Newsletter - It's Free!
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!
+ 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!
2011-10-03, 12:46 #2
- Join Date
- Feb 2001
- Willow Grove, Pennsylvania, USA
- Thanked 45 Times in 37 Posts
You didn't mention endnotes, but they work the same way so I threw them in.
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.