View Single Post
 
Old 08-26-2022, 07:58 AM
Shelley Lou Shelley Lou is offline Windows 10 Office 2016
Competent Performer
 
Join Date: Dec 2020
Posts: 170
Shelley Lou is on a distinguished road
Default VBA Footnote References Before Punctuation

Hi Macropod, thanks for the update, I got a Syntax error so I changed the code to:

Code:
Do While .Characters.First.Previous Like "[!0-9A-Za-z" & Chr(39) & Chr(34) & Chr(41) & vbCr & Chr(11) & vbTab & "]"
And that seems to have worked.

Thank you so much for your help, really appreciate it.

Before I close this thread as solved - I've got some rogue spaces between the footnote reference and punctuation after running the code - I've tried adding the following at the end of the Sub SetPunctAfter macro but it doesn't seem to be working - it works when I do a normal find and replace but not when in the code.

Code:
With Rng.Find
.text = "(^2)[ ]([.,:;\?\!])"
.Replacement.text = "\1\2"
.Execute Replace:=wdReplaceAll
End With
Reply With Quote