Hi Guys,
I have output documents that have extra blank line spaces that have a size of
2pt. I am trying to create a macro that should delete all instances of this
2pt size line spaces. However my macro below only works to some extent, when
a document have two blank lines that are both in size 2, it only deletes 1
blank space. If i run the macro again it still does not remove the the
remaining blank line space.
Sub Delete2ptLineSpace()
With ActiveDocument.Content.Find
.ClearFormatting
.Replacement.ClearFormatting
With .Font
.Size = 2
End With
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
End Sub
i would greatly appreciate any assistance regarding this.
Thanks and regards,
gaubahn
Greg Maxey - 23 Oct 2007 13:19 GMT
This should work:
Sub ScratchMacro()
Dim oPar As Paragraph
For Each oPar In ActiveDocument.Range.Paragraphs
If Len(oPar.Range.Text) = 1 And oPar.Range.Font.Size = 8 Then
oPar.Range.Delete
End If
Next
End Sub

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
> Hi Guys,
>
[quoted text clipped - 33 lines]
> Thanks and regards,
> gaubahn
Russ - 23 Oct 2007 19:03 GMT
Gaubahn,
This will remove all paragraph marks with that size:
Public Sub Delete2ptLineSpace()
With ActiveDocument.Content.Find
.Font.Size = 2
.Text = "^13" '\n on a Mac
.Replacement.Text = ""
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
End Sub
Note: The normal way to space between paragraphs in Word is not with extra
blank lines, but by using properties of paragraphs called space before and
space after. Styles can be set up to easily apply those paragraph
properties.
> Hi Guys,
>
[quoted text clipped - 30 lines]
> Thanks and regards,
> gaubahn

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID
gaubahn - 25 Oct 2007 08:34 GMT
Hi Greg and Russ,
Thank you very much for your help I was finally able to get rid of the blank
spaces.
Thanks and regards,
gau
>Gaubahn,
>
[quoted text clipped - 19 lines]
>> Thanks and regards,
>> gaubahn