View Single Post
 
Old 09-21-2023, 08:13 AM
RobiNew RobiNew is offline Windows 10 Office 2016
Competent Performer
 
Join Date: Sep 2023
Posts: 183
RobiNew is on a distinguished road
Default

I apologize! I'm new to these procedures. My aim is to invert reference numbers and punctuation. This I obtained with Macropod's code here below (slightly adapted with regard to some special quotation marks). However, in the text some of the paragraphs involved are left-indented and in these I don't want the inversion to operate. How do I modify (or add to) the code so that the sequence 'punctuation-ref.number' is left untouched in left-indented paragraphs? Thank you for your time!


This is the code I adapted:

Quote:
Application.ScreenUpdating = False
Dim FtNt As Footnote
Dim Rng As Range
With ActiveDocument
For Each FtNt In .Footnotes
Set Rng = FtNt.Reference
With Rng
'Delete spaces etc.
Do While .Characters.First.Previous Like "[ " & Chr(160) & "]"
.Characters.First.Previous.Text = vbNullString
Loop
'Invert ref. number and punctuation
Do While Not .Characters.First.Previous Like "[0-9A-Za-z]" And Not .Characters.First.Previous Like "‹" And Not .Characters.First.Previous Like "«"
.InsertAfter. Characters.First.Previous
.Characters.First.Previous.Delete
Loop
End With
Next
End With
Reply With Quote