Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-05-2017, 03:24 PM
macropod's Avatar
macropod macropod is offline Move full stops to other end of a citation Windows 7 64bit Move full stops to other end of a citation Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,523
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

Try:


Code:
Sub FixRefs()
Application.ScreenUpdating = False
ActiveWindow.View.ShowFieldCodes = True
With ActiveDocument
  Call FndRep(.Range)
  Call FndRep(.StoryRanges(wdEndnotesStory))
  Call FndRep(.StoryRanges(wdFootnotesStory))
End With
ActiveWindow.View.ShowFieldCodes = False
Application.ScreenUpdating = True
End Sub

Sub FndRep(Rng As Range)
With Rng
  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
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 11-30-2023, 08:16 PM
Guessed's Avatar
Guessed Guessed is offline Move full stops to other end of a citation Windows 10 Move full stops to other end of a citation Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

deepapme
The code from #14 on this thread works on my machine. You could post a sample document that the code doesn't work on if you want a quick answer otherwise we can go through a series of steps to find out what you actually have in your document.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 12-01-2023, 06:09 PM
Guessed's Avatar
Guessed Guessed is offline Move full stops to other end of a citation Windows 10 Move full stops to other end of a citation Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

That document is showing citations put in by a third party tool called Mendeley. This doesn't appear to use the built-in Microsoft citations feature and that is why the macro has no effect in that particular file.

So before developing an all-new solution for your problem, you should first determine whether the tool that created those 'citations' has a capability to perform the change that you require. If it doesn't then a completely different macro would need to work through the content controls that Mendeley has put there. This macro appears to work on your sample
Code:
Sub MoveMendeleyCitations()
  Dim aCC As ContentControl, aRng As Range
  For Each aCC In ActiveDocument.ContentControls
    If aCC.Tag Like "MENDELEY_CITATION*" Then
      Set aRng = aCC.Range
      aRng.Start = aRng.Start - 2
      aRng.End = aRng.End + 1
      Do While aRng.Characters.First = " "
        aRng.Start = aRng.Start - 1
      Loop
      aRng.Select
      If aRng.Characters.First Like "[?!:;.]" Then
        aRng.InsertAfter aRng.Characters.First
        aRng.Characters.First.Delete
        If aRng.Characters.First <> " " Then aRng.InsertBefore " "
      End If
    End If
  Next aCC
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #4  
Old 12-01-2023, 09:15 PM
deepapme@gmail.com deepapme@gmail.com is offline Move full stops to other end of a citation Windows 11 Move full stops to other end of a citation Office 2021
Novice
 
Join Date: Nov 2023
Posts: 3
deepapme@gmail.com is on a distinguished road
Smile

Thanks a lot. That works like a magic. I am grateful to you!!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Move full stops to other end of a citation Word 2014: WPerfect 6.x full-justification "stops working" dan_1 Word 12 01-24-2017 12:43 PM
Move full stops to other end of a citation Insert Citation truepharaoh Word 3 12-03-2016 01:35 AM
Move full stops to other end of a citation How to display the full citation in footnotes/endnotes chakyt22 Word 1 09-29-2015 03:37 AM
Move full stops to other end of a citation Why are full stops appearing in between every word I type?? richards_jacqui@sky.com Outlook 1 04-01-2015 10:40 PM
Move full stops to other end of a citation Citation within a Caption Wes Word 1 05-29-2012 10:29 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:03 AM.


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