![]() |
|
|
|
#1
|
||||
|
||||
|
Thanks for answer.
Instead of clicking I copy pasted link in google and it lead me to. http://www.vbaexpress.com/forum/show...raphs-from-PDF Changed it the way you descrived. Solved my problem Code:
Sub PasteCleanUpText()
Application.ScreenUpdating = False
Dim oRng As Range
Set oRng = Selection.Range
oRng.Paste
'oRng = Replace(oRng, Chr(13), " ")
oRng.ParagraphFormat.Reset
oRng.Font.Reset
With oRng.Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
'Replace single paragraph breaks with a space
.Text = "([!^13])([^13])([!^13])"
.Replacement.Text = "\1 \3"
.Execute Replace:=wdReplaceAll
'Replace all double spaces with single spaces
.Text = "[ ]{2,}"
.Replacement.Text = " "
.Execute Replace:=wdReplaceAll
'Delete hypens in hyphenated text formerly split across lines
'.Text = "([a-z])-[ ]{1,}([a-z])"
'.Replacement.Text = "\1 \2" 'formerly \1\2
'.Execute Replace:=wdReplaceAll
'Limit paragraph breaks to one per 'real' paragraph.
.Text = "[^13]{1,}"
.Replacement.Text = "^p"
.Execute Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
End Sub
|
|
| Tags |
| word 2010, word vba |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How to select and copy to clipboard an entire document except for a paragraph and keep formatting
|
TD_123 | Word VBA | 7 | 06-16-2015 03:30 PM |
| How can I temporarily break a 3 column format in order to type a single column paragraph | William P | Word | 1 | 01-04-2015 06:40 PM |
| Controlling Widows (single-word lines at the end of a paragraph) | downtownbooks | Word | 2 | 12-09-2014 03:57 PM |
Get para no where txt is found, and move text to end of paragraph using Word 201
|
marceepoo | Word VBA | 2 | 12-20-2012 11:42 AM |
A macro that can insert FILENAME, sendkeys CTRL ALT T, paste clipboard, and nextline
|
kyjac85 | Word VBA | 13 | 09-20-2012 05:00 PM |