Hi, just wondering if anyone has made one already (Please
dont waste your time writing it unless you have it), I
need a macro that will go through a document and spot
places where there is more than one blank line between
lines with text and leave only one line. I'm looking for
a simple recursive function. I can write a big function
to do it but I think there is a simpler way I'm
unfamiliar with. NOTE: I tried lookign for consecutive
line breaks replacing them with one line break but that
didn't really work.

Re: Macro to eliminate mutiple blank lines. by Helmut

Helmut
Wed Jul 07 09:32:10 CDT 2004

Hi,
what happened, when you tried to replace consecutive
line breaks with one line break? How did you try?
What means "didn't really work"?
Did it work every now and then?
Could you give us some sample text and your code?
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98


Re: Macro to eliminate mutiple blank lines. by Joost

Joost
Wed Jul 07 13:48:12 CDT 2004


>-----Original Message-----
>Well the thing I did try, since I didn't have time to
>code anything, usign the repalce command I put in "^l^l"
>in the find window, which is the code for manual line
>break I believe, and I put in "^l" in teh replace with
>window. However becuase the characters are on different
>lines, my theory anyway, it couldnt find two consecutive
>line breaks. Another theory of mine was that becuase the
>file I was working with was downloaded from a database
in
>a RTF format, perhaps it was a different kind of line
>break, non-manual if such exists, so looking for a
manual
>line break might not be the way to go. So in any case it
>didn't do anything, no replacements were made.
>
>I know I could code soemthign that goes line by line
>analyzin whats in the line and if its essentually
nothing
>it can record two consecutive events of nothing found
and
>delete one line. But as I said I hardly have the time at
>the moment for a side project.
>
>
>
>>-----Original Message-----
>>Hi,
>>what happened, when you tried to replace consecutive
>>line breaks with one line break? How did you try?
>>What means "didn't really work"?
>>Did it work every now and then?
>>Could you give us some sample text and your code?
>>Greetings from Bavaria, Germany
>>Helmut Weber, MVP
>>"red.sys" & chr(64) & "t-online.de"
>>Word XP, Win 98
>>
>>.
>>
>.
>

Hi,

In a module:

Option Explicit

Public Function test() As Boolean
Dim x As Variant
Dim i As Integer

With Selection
.HomeKey Unit:=wdStory

For Each x In ActiveDocument.Paragraphs
If Len(x) = 1 And i = 1 Then
.TypeBackspace
ElseIf Len(x) = 1 Then
i = 1
Else
i = 0
End If
.MoveDown , 1
Next
End With
End Function

Sub Enters()
Call test
End Sub

Close the VBE en press ALT+F8
Run ENTERS

Have Fun!

Joost Verdaasdonk
The Netherlands

Re: Macro to eliminate mutiple blank lines. by WCyrek

WCyrek
Wed Jul 07 13:57:39 CDT 2004

Thank you so much I'll test it in a bit. I especially
like .TypeBackspace

>-----Original Message-----
>
>>-----Original Message-----
>>Well the thing I did try, since I didn't have time to
>>code anything, usign the repalce command I put
in "^l^l"
>>in the find window, which is the code for manual line
>>break I believe, and I put in "^l" in teh replace with
>>window. However becuase the characters are on different
>>lines, my theory anyway, it couldnt find two
consecutive
>>line breaks. Another theory of mine was that becuase
the
>>file I was working with was downloaded from a database
>in
>>a RTF format, perhaps it was a different kind of line
>>break, non-manual if such exists, so looking for a
>manual
>>line break might not be the way to go. So in any case
it
>>didn't do anything, no replacements were made.
>>
>>I know I could code soemthign that goes line by line
>>analyzin whats in the line and if its essentually
>nothing
>>it can record two consecutive events of nothing found
>and
>>delete one line. But as I said I hardly have the time
at
>>the moment for a side project.
>>
>>
>>
>>>-----Original Message-----
>>>Hi,
>>>what happened, when you tried to replace consecutive
>>>line breaks with one line break? How did you try?
>>>What means "didn't really work"?
>>>Did it work every now and then?
>>>Could you give us some sample text and your code?
>>>Greetings from Bavaria, Germany
>>>Helmut Weber, MVP
>>>"red.sys" & chr(64) & "t-online.de"
>>>Word XP, Win 98
>>>
>>>.
>>>
>>.
>>
>
>Hi,
>
>In a module:
>
>Option Explicit
>
>Public Function test() As Boolean
> Dim x As Variant
> Dim i As Integer
>
> With Selection
> .HomeKey Unit:=wdStory
>
> For Each x In ActiveDocument.Paragraphs
> If Len(x) = 1 And i = 1 Then
> .TypeBackspace
> ElseIf Len(x) = 1 Then
> i = 1
> Else
> i = 0
> End If
> .MoveDown , 1
> Next
> End With
>End Function
>
>Sub Enters()
> Call test
>End Sub
>
>Close the VBE en press ALT+F8
>Run ENTERS
>
>Have Fun!
>
>Joost Verdaasdonk
>The Netherlands
>.
>

Re: Macro to eliminate mutiple blank lines. by Joost

Joost
Wed Jul 07 14:11:51 CDT 2004

Hi,

You're welcom!

Have Fun,
Joost
>-----Original Message-----
>Thank you so much I'll test it in a bit. I especially
>like .TypeBackspace
>
>>-----Original Message-----
>>
>>>-----Original Message-----
>>>Well the thing I did try, since I didn't have time to
>>>code anything, usign the repalce command I put
>in "^l^l"
>>>in the find window, which is the code for manual line
>>>break I believe, and I put in "^l" in teh replace with
>>>window. However becuase the characters are on
different
>>>lines, my theory anyway, it couldnt find two
>consecutive
>>>line breaks. Another theory of mine was that becuase
>the
>>>file I was working with was downloaded from a database
>>in
>>>a RTF format, perhaps it was a different kind of line
>>>break, non-manual if such exists, so looking for a
>>manual
>>>line break might not be the way to go. So in any case
>it
>>>didn't do anything, no replacements were made.
>>>
>>>I know I could code soemthign that goes line by line
>>>analyzin whats in the line and if its essentually
>>nothing
>>>it can record two consecutive events of nothing found
>>and
>>>delete one line. But as I said I hardly have the time
>at
>>>the moment for a side project.
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>Hi,
>>>>what happened, when you tried to replace consecutive
>>>>line breaks with one line break? How did you try?
>>>>What means "didn't really work"?
>>>>Did it work every now and then?
>>>>Could you give us some sample text and your code?
>>>>Greetings from Bavaria, Germany
>>>>Helmut Weber, MVP
>>>>"red.sys" & chr(64) & "t-online.de"
>>>>Word XP, Win 98
>>>>
>>>>.
>>>>
>>>.
>>>
>>
>>Hi,
>>
>>In a module:
>>
>>Option Explicit
>>
>>Public Function test() As Boolean
>> Dim x As Variant
>> Dim i As Integer
>>
>> With Selection
>> .HomeKey Unit:=wdStory
>>
>> For Each x In ActiveDocument.Paragraphs
>> If Len(x) = 1 And i = 1 Then
>> .TypeBackspace
>> ElseIf Len(x) = 1 Then
>> i = 1
>> Else
>> i = 0
>> End If
>> .MoveDown , 1
>> Next
>> End With
>>End Function
>>
>>Sub Enters()
>> Call test
>>End Sub
>>
>>Close the VBE en press ALT+F8
>>Run ENTERS
>>
>>Have Fun!
>>
>>Joost Verdaasdonk
>>The Netherlands
>>.
>>
>.
>

Re: Macro to eliminate mutiple blank lines. by WCyrek

WCyrek
Wed Jul 07 14:20:13 CDT 2004

Works perfectly. I gave you credit in the comments incase
I stick it in a userform later. So no need to sue :)


>-----Original Message-----
>Hi,
>
>You're welcom!
>
>Have Fun,
>Joost
>>-----Original Message-----
>>Thank you so much I'll test it in a bit. I especially
>>like .TypeBackspace
>>
>>>-----Original Message-----
>>>
>>>>-----Original Message-----
>>>>Well the thing I did try, since I didn't have time to
>>>>code anything, usign the repalce command I put
>>in "^l^l"
>>>>in the find window, which is the code for manual line
>>>>break I believe, and I put in "^l" in teh replace
with
>>>>window. However becuase the characters are on
>different
>>>>lines, my theory anyway, it couldnt find two
>>consecutive
>>>>line breaks. Another theory of mine was that becuase
>>the
>>>>file I was working with was downloaded from a
database
>>>in
>>>>a RTF format, perhaps it was a different kind of line
>>>>break, non-manual if such exists, so looking for a
>>>manual
>>>>line break might not be the way to go. So in any case
>>it
>>>>didn't do anything, no replacements were made.
>>>>
>>>>I know I could code soemthign that goes line by line
>>>>analyzin whats in the line and if its essentually
>>>nothing
>>>>it can record two consecutive events of nothing found
>>>and
>>>>delete one line. But as I said I hardly have the time
>>at
>>>>the moment for a side project.
>>>>
>>>>
>>>>
>>>>>-----Original Message-----
>>>>>Hi,
>>>>>what happened, when you tried to replace consecutive
>>>>>line breaks with one line break? How did you try?
>>>>>What means "didn't really work"?
>>>>>Did it work every now and then?
>>>>>Could you give us some sample text and your code?
>>>>>Greetings from Bavaria, Germany
>>>>>Helmut Weber, MVP
>>>>>"red.sys" & chr(64) & "t-online.de"
>>>>>Word XP, Win 98
>>>>>
>>>>>.
>>>>>
>>>>.
>>>>
>>>
>>>Hi,
>>>
>>>In a module:
>>>
>>>Option Explicit
>>>
>>>Public Function test() As Boolean
>>> Dim x As Variant
>>> Dim i As Integer
>>>
>>> With Selection
>>> .HomeKey Unit:=wdStory
>>>
>>> For Each x In ActiveDocument.Paragraphs
>>> If Len(x) = 1 And i = 1 Then
>>> .TypeBackspace
>>> ElseIf Len(x) = 1 Then
>>> i = 1
>>> Else
>>> i = 0
>>> End If
>>> .MoveDown , 1
>>> Next
>>> End With
>>>End Function
>>>
>>>Sub Enters()
>>> Call test
>>>End Sub
>>>
>>>Close the VBE en press ALT+F8
>>>Run ENTERS
>>>
>>>Have Fun!
>>>
>>>Joost Verdaasdonk
>>>The Netherlands
>>>.
>>>
>>.
>>
>.
>

Re: Macro to eliminate mutiple blank lines. by Joost

Joost
Thu Jul 08 13:29:24 CDT 2004

Hahahaha, :D

Feel free to use it as you please!

Have fun ;-)

Joost Verdaasdonk
>-----Original Message-----
>Works perfectly. I gave you credit in the comments
incase
>I stick it in a userform later. So no need to sue :)
>
>
>>-----Original Message-----
>>Hi,
>>
>>You're welcom!
>>
>>Have Fun,
>>Joost
>>>-----Original Message-----
>>>Thank you so much I'll test it in a bit. I especially
>>>like .TypeBackspace
>>>
>>>>-----Original Message-----
>>>>
>>>>>-----Original Message-----
>>>>>Well the thing I did try, since I didn't have time
to
>>>>>code anything, usign the repalce command I put
>>>in "^l^l"
>>>>>in the find window, which is the code for manual
line
>>>>>break I believe, and I put in "^l" in teh replace
>with
>>>>>window. However becuase the characters are on
>>different
>>>>>lines, my theory anyway, it couldnt find two
>>>consecutive
>>>>>line breaks. Another theory of mine was that becuase
>>>the
>>>>>file I was working with was downloaded from a
>database
>>>>in
>>>>>a RTF format, perhaps it was a different kind of
line
>>>>>break, non-manual if such exists, so looking for a
>>>>manual
>>>>>line break might not be the way to go. So in any
case
>>>it
>>>>>didn't do anything, no replacements were made.
>>>>>
>>>>>I know I could code soemthign that goes line by line
>>>>>analyzin whats in the line and if its essentually
>>>>nothing
>>>>>it can record two consecutive events of nothing
found
>>>>and
>>>>>delete one line. But as I said I hardly have the
time
>>>at
>>>>>the moment for a side project.
>>>>>
>>>>>
>>>>>
>>>>>>-----Original Message-----
>>>>>>Hi,
>>>>>>what happened, when you tried to replace
consecutive
>>>>>>line breaks with one line break? How did you try?
>>>>>>What means "didn't really work"?
>>>>>>Did it work every now and then?
>>>>>>Could you give us some sample text and your code?
>>>>>>Greetings from Bavaria, Germany
>>>>>>Helmut Weber, MVP
>>>>>>"red.sys" & chr(64) & "t-online.de"
>>>>>>Word XP, Win 98
>>>>>>
>>>>>>.
>>>>>>
>>>>>.
>>>>>
>>>>
>>>>Hi,
>>>>
>>>>In a module:
>>>>
>>>>Option Explicit
>>>>
>>>>Public Function test() As Boolean
>>>> Dim x As Variant
>>>> Dim i As Integer
>>>>
>>>> With Selection
>>>> .HomeKey Unit:=wdStory
>>>>
>>>> For Each x In ActiveDocument.Paragraphs
>>>> If Len(x) = 1 And i = 1 Then
>>>> .TypeBackspace
>>>> ElseIf Len(x) = 1 Then
>>>> i = 1
>>>> Else
>>>> i = 0
>>>> End If
>>>> .MoveDown , 1
>>>> Next
>>>> End With
>>>>End Function
>>>>
>>>>Sub Enters()
>>>> Call test
>>>>End Sub
>>>>
>>>>Close the VBE en press ALT+F8
>>>>Run ENTERS
>>>>
>>>>Have Fun!
>>>>
>>>>Joost Verdaasdonk
>>>>The Netherlands
>>>>.
>>>>
>>>.
>>>
>>.
>>
>.
>