![]() |
|
#1
|
|||
|
|||
|
I execute the following Macro after manually selecting a block of text that has been pasted into Word from a PDF to replace all the line breaks with spaces and thus make it a single, normal paragraph:
Code:
Sub LinkLinesOfPDF_Text()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = vbCr
.Replacement.Text = " "
.Forward = False '!!!
.Wrap = wdFindStop '!!!
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute , , , , , , , , , , wdReplaceAll
' remove double spaces:
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " "
.Replacement.Text = " "
.Forward = False
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Is this delay unavoidable, or is there a more elegant, efficient way for me to replace all new lines with spaces in a given selection of text? Thank you so much in advance! |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Execute autocorrects? | KaiserD2 | Word | 6 | 04-03-2017 10:18 PM |
| Simple Hide columns macro, when I execute it hides everything left of selection, please help | mcronin | Excel Programming | 2 | 08-31-2016 05:15 PM |
I need to convert shaded text into highlighted text on about 80 different long documents. VBA macro?
|
AustinBrister | Word VBA | 8 | 05-28-2015 02:42 PM |
Find and Execute
|
cksm4 | Word VBA | 1 | 10-22-2011 11:36 PM |
How do I call/execute an Excel macro from Access 2003
|
KramerJ | Excel | 2 | 05-11-2009 11:33 AM |