Quote:
Originally Posted by sjohnson
I also attached a modified example to show what I was trying to do for the second code (this is example 3)
|
Try the revised code below.
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Rng As Range
Set Rng = Selection.Range
With Rng
.PasteAndFormat (wdFormatSurroundingFormattingWithEmphasis)
With .Duplicate
.End = .Paragraphs.First.Range.End
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Format = False
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
.Text = "[“”\(\[\)\]]"
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
.Text = Chr(34)
.Replacement.Text = """"
.Execute Replace:=wdReplaceAll
.Text = ". . ."
.Replacement.Text = "…"
.Execute Replace:=wdReplaceAll
.Text = "^s"
.Replacement.Text = " "
.Execute Replace:=wdReplaceAll
.Text = "[ ]{2,}"
.Replacement.Text = " "
.Execute Replace:=wdReplaceAll
.Text = "[^l^13]{1,}"
.Replacement.Text = "^p"
.Execute Replace:=wdReplaceAll
End With
End With
If MsgBox("Swap Citation & Reference?", vbYesNo) = vbYes Then
With .Find
.Text = "(*)^13(*^13)"
.Replacement.Text = "\2(\1)^p"
.Wrap = wdFindStop
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
End If
.Paragraphs.First.Range.Characters.Last = " "
.Start = .Paragraphs.First.Range.End
.Select
End With
Application.ScreenUpdating = True
End Sub
Quote:
Originally Posted by sjohnson
First, what am I doing incorrectly in my modification to move the cursor to the end of what I just pasted in?
|
To move the start to the end of Rng, you need to work the Rng, not Selection. See the revised code.
Quote:
Originally Posted by sjohnson
Second, how can I add in an the quotation marks omitted and alterations removed?
|
I don't know what you mean by that.
Quote:
Originally Posted by sjohnson
Third, when I modified the code to paste in items, it changes everything in the paragraph, not just the pasted in items (meaning if the previous already existed sentence has a bracket, it removes that bracket after it pastes in the new stuff).
|
The code was written on the premise that what is being worked on is being pasted into a new paragraph. Your examples didn't indicate otherwise. I have revised the code to allow pasting into an existing paragraph.