![]() |
|
|
|
#1
|
|||
|
|||
|
Hi, using Macropod's macro - it doesn't seem to work anymore. Any ideas please most welcome.
Code:
Sub CleanUpPastedText()
'Turn Off Screen Updating Macropod
Application.ScreenUpdating = False
Dim StrFR As String, i As Long
'Paired F/R expressions, each separated by |
StrFR = "[ ^s^t]{1,}^13|^p|([!^13^l])([^13^l])([!^13^l])|\1 \3|[^s ]{2,}| |([a-z])-[^s ]{1,}([a-z])|\1\2|[^13^l]{1,}|^p"
'Address any Internationalisation issues
If Application.International(wdListSeparator) = ";" Then
StrFR = Replace(StrFR, ",", ";")
End If
With ActiveDocument.Range.Find
.ClearFormatting
.replacement.ClearFormatting
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
'Process all F/R expressions
For i = 0 To UBound(Split(StrFR, "|")) Step 2
.text = Split(StrFR, "|")(i)
.replacement.text = Split(StrFR, "|")(i + 1)
.Execute Replace:=wdReplaceAll
Next
End With
'Restore Screen Updating
Application.ScreenUpdating = True
End Sub
|
|
#2
|
||||
|
||||
|
It worked for me.
Are you getting an error? Or just not seeing any change in the active document?
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
#3
|
|||
|
|||
|
Hi Andrew
No change in active document. I must be missing something. |
|
#4
|
||||
|
||||
|
Works for me on your sample document...
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#5
|
|||
|
|||
|
Hi Macropod and Andrew
I just downloaded the document I uploaded and ran the macro again. It worked. Thank you both for looking at this. |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How to release hard returns?
|
markg2 | Word | 13 | 05-08-2023 01:38 PM |
| Remove only some hard returns | falcios | Word | 4 | 05-11-2021 07:02 PM |
Returns in Word table text become multiple rows when pasted in Excel
|
blorence | Word Tables | 8 | 01-23-2019 01:57 PM |
| Unwanted Hard Returns when using Heading Styles | alfondacaro | Word | 3 | 11-27-2013 07:46 AM |
| hard lines across document - can't remove | joanieS | Word | 3 | 07-30-2013 11:29 AM |