Reply
 
Thread Tools Display Modes
  #1   Report Post  
Fred
 
Posts: n/a
Default Remove empty paragraphs

In converting web pages to word docs I get a lot of empty paragraphs. I'd
like to delete them quickly. What is the best way?

I tried the "find" (^13){1,}, "replace with" \1 . That didn't work for me.
  #2   Report Post  
garfield-n-odie
 
Posts: n/a
Default

See http://www.word.mvps.org/FAQs/Format...eanWebText.htm .

Fred wrote:

In converting web pages to word docs I get a lot of empty paragraphs. I'd
like to delete them quickly. What is the best way?

I tried the "find" (^13){1,}, "replace with" \1 . That didn't work for me.


  #3   Report Post  
Greg Maxey
 
Posts: n/a
Default

Fred,

See:
http://word.mvps.org/FAQs/Formatting/CleanWebText.htm


I use this macro to clean up web text:

Sub CleanUpText()

Dim EP As Paragraph
Dim Response1 As Long
Dim Response2 As Long
Dim Response3 As Long
Dim Response4 As String

Response3 = MsgBox("Do you want to remove leading spaces or characters?",
vbYesNo)
If Response3 = vbYes Then
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^l {1,}"
.Replacement.Text = "^l"
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^l[\]{1,}"
.Replacement.Text = "^l"
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^13[\]{1,}"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^13 {1,}"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^l {1,}"
.Replacement.Text = "^l"
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Response4 = InputBox("Type in any additional leading character")

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = Response4
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End If
Response2 = MsgBox("Do you want to replace linebreaks with paragraph
fromatting?", vbYesNo)
If Response2 = vbYes Then
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^l{2,}"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^l"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
End If
Response1 = MsgBox("Do you want to delete empty paragraphs in this
document?", vbYesNo)
If Response1 = vbYes Then
For Each EP In ActiveDocument.Paragraphs
If Len(EP.Range.Text) = 1 Then EP.Range.Delete
Next EP
End If


End Sub

--
Greg Maxey/Word MVP
A Peer in Peer to Peer Support

Fred wrote:
In converting web pages to word docs I get a lot of empty paragraphs.
I'd like to delete them quickly. What is the best way?

I tried the "find" (^13){1,}, "replace with" \1 . That didn't work
for me.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove Spell Check Feature pauliner Microsoft Word Help 1 January 6th 05 06:28 PM
remove hiddens files should read remove hidden data. rhdtool.exe ketch Microsoft Word Help 2 December 23rd 04 07:12 PM
Word Templates Remove Timo Microsoft Word Help 3 December 21st 04 08:15 AM
Track changes and Remove Hidden Data hangs! Martin Microsoft Word Help 0 December 16th 04 07:37 AM
When making labels, how do you delete empty cells? Melissa Microsoft Word Help 1 December 1st 04 05:26 PM


All times are GMT +1. The time now is 02:55 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"