![]() |
#1
|
|||
|
|||
![]()
I have been given quite a few 200 page contract documents to house style/format each containing over 300 footnotes. I recorded a find and replace to move the punctuation before the footnotes refs - but when I added code to remove spaces before footnotes refs it stopped working.
Code:
.text = "([.,:;\?\!])(^2)" What have I missed from the code to make it work correctly. Capture.PNG Code:
Sub MoveFootnotesBeforePunctuation() Dim oRng As Range, oFN As Footnote For Each oFN In ActiveDocument.Footnotes 'Remove spaces before footnote refs Do While oFN.Reference.Characters.First.Previous Like "[" & Chr(32) + Chr(160) & "]" oFN.Reference.Characters.First.Previous.Delete Loop Next Set oRng = ActiveDocument.Range With oRng.Find .ClearFormatting .Replacement.ClearFormatting .text = "([.,:;\?\!])(^2)" 'Move footnote refs before punctuation .Replacement.text = "\2\1" .text = "([\]])(^2)(^13)" 'Move footnote refs before square brackets end of paras .Replacement.text = "\2\1\3" .text = "([.;:])([\]])(^2)(^13)" 'Move footnote refs before square brackets and punctuation .Replacement.text = "\3\2\1\4" .MatchWildcards = True .Execute Replace:=wdReplaceAll End With End With End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
emblaw | Word | 4 | 12-08-2020 06:23 AM |
![]() |
KDuncan | Word | 6 | 04-28-2020 12:14 AM |
![]() |
michaelbriordan | Word | 3 | 06-17-2015 10:12 AM |
![]() |
bearligirl89 | Word | 3 | 11-20-2013 03:33 PM |
![]() |
jimgard | Word | 1 | 07-23-2013 11:47 AM |