Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-16-2022, 07:53 PM
jec1 jec1 is offline Clean Up Pasted Text from PDF (hard returns end of lines) Windows 10 Clean Up Pasted Text from PDF (hard returns end of lines) Office 2019
Advanced Beginner
Clean Up Pasted Text from PDF (hard returns end of lines)
 
Join Date: Jan 2012
Posts: 84
jec1 is on a distinguished road
Default Clean Up Pasted Text from PDF (hard returns end of lines)


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
Attached Files
File Type: docx Clean Up Text pasted from pdf with macro.docx (50.3 KB, 11 views)
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Clean Up Pasted Text from PDF (hard returns end of lines) 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
Clean Up Pasted Text from PDF (hard returns end of lines) 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

Other Forums: Access Forums

All times are GMT -7. The time now is 12:30 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