![]() |
|
#8
|
||||
|
||||
|
Quote:
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:
Quote:
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.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How to modify the code to meet the corresponding requirements
|
leeqiang | Excel Programming | 10 | 04-17-2022 03:30 AM |
how modify a macro code
|
tarikov2006 | Excel Programming | 1 | 11-18-2016 04:10 AM |
| Modify right-click context menu to only allow pasting text | derajlance | Word VBA | 0 | 05-24-2016 02:25 PM |
Recovering/Removing a Password to Modify PPAM Code
|
Steve_B | PowerPoint | 3 | 01-08-2014 01:06 PM |
| Modify vba code to print based on name in the InputBox | OTPM | Project | 0 | 05-25-2011 02:03 AM |