Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-05-2019, 05:54 PM
macropod's Avatar
macropod macropod is offline Help needed with moving footnotes Windows 7 64bit Help needed with moving footnotes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The following macro ensures all Footnote & Endnote references are placed after any applicable adjacent punctuation marks. Any preceding space characters are also deleted.
Code:
Sub FootnoteEndnoteFix()
Application.ScreenUpdating = False
Dim FtNt As Footnote, EndNt As Endnote, Rng As Range
With ActiveDocument
  For Each FtNt In .Footnotes
    Set Rng = FtNt.Reference
    With Rng
      'Eliminate any spaces before the footnote
      While .Characters.First.Previous.Text = " "
        .Characters.First.Previous.Text = vbNullString
      Wend
      'Swap the footnote/punctuation, as applicable
      Select Case .Characters.Last.Next
        Case ".", ",", "!", "?", ":", ";"
        .InsertBefore .Characters.Last.Next
        .Characters.Last.Next.Delete
      End Select
    End With
  Next
  For Each EndNt In .Endnotes
    Set Rng = EndNt.Reference
    With Rng
      'Eliminate any spaces before the endnote
      While .Characters.First.Previous.Text = " "
        .Characters.First.Previous.Text = vbNullString
      Wend
      'Swap the endnote/punctuation, as applicable
      Select Case .Characters.Last.Next
        Case ".", ",", "!", "?", ":", ";"
        .InsertBefore .Characters.Last.Next
        .Characters.Last.Next.Delete
      End Select
    End With
  Next
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help needed with moving footnotes How to change superscript footnotes into genuine Word footnotes Knounte29 Word VBA 41 01-16-2020 04:48 PM
creating manuscript w/footnotes from separate documents containing chapters with footnotes-word 2010 Dottie Publisher 0 02-19-2017 03:18 PM
Convert manual cross references in footnotes to other footnotes to automatic cross references ghumdinger Word VBA 7 11-20-2014 11:47 PM
Help needed with moving footnotes Moving cell content without moving borders & shading? unittwentyfive Excel 1 10-25-2013 12:56 PM
Help needed with moving footnotes Moving formula range multiple cells when moving sum over one cell FraserKitchell Excel 4 02-26-2010 10:38 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:04 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft