View Single Post
 
Old 06-27-2023, 12:16 AM
kelstar kelstar is offline Windows 10 Office 2021
Novice
 
Join Date: Jun 2023
Posts: 1
kelstar is on a distinguished road
Default Hi Macropod - I would really appreciate your help

Hi there,

Macropod provided code back in 2017 to somebody that needed to change the placement of the references in relation to the full stops (as below). I am need of the opposite alteration to the original i.e., my references currently sit before the full stops but need to be transferred to after the full stop. I'm sure anyone that wasn't as oblivious to coding as me could alter the original code provided by Macropod, but this isn't me.
Any help would be greatly appreciated and save me days of work and frustration.


Quote:
Originally Posted by macropod View Post
Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
ActiveWindow.View.ShowFieldCodes = True
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "^d CITATION"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute
  End With
  Do While .Find.Found
    .Start = .Start - 1
    .MoveStartWhile " ", -1
    .Start = .Start - 1
    If .Characters.First Like "[?!:;.]" Then
      .End = .End + 1
      .InsertAfter .Characters.First
      With .Duplicate
        .Collapse wdCollapseStart
        .MoveEndWhile " ", 1
        .Delete
      End With
    End If
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
ActiveWindow.View.ShowFieldCodes = False
Application.ScreenUpdating = True
End Sub
Reply With Quote