Remove spaces (Hard-returns) at top of pages

G

Guest

How can I remove all spaces (lines) aka? Hard-returns at the top of a page in
my document, is there a macro I can do this with.

It should be something to write as "clean-up-process" after editing a doc,
since any editing would move text around again and obviously result in some
spaces at the top of a doc.

I tried to look for some examples but most removes all line breaks or
hard-returns, I am looking only for something that will find theses spaces
(breaks) at the top of the page and remove them up to the first line of text
on that page.

Hope this makes sense
 
T

Tony Jollans

I don't see why you 'obviously' have lots of spaces and returns at the start
of a document - but if that's all you want to get rid of you're not going to
find anything a whole lot easier than going to the top of the document and
doing it manually

I just did a search for the first non-space non-paragraph mark and recorded
this if it helps ...

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 28/03/2006 by Tony
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[!^13 ]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
Selection.TypeBackspace
End Sub
 
G

Guest

Tony.

No no, not the top of the document, at the top of certain pages, I have 7
documents, some with over 500 pages, so for me to go and try to find a space
(or more) at the top of a page and deleting them by hand is not that easy,
and then someone changes the document and I have to do a search and find all
over again to make sure each page of the 500 page document has no spaces at
the top ...thats where the problem comes in.

Thanks for the code, going to try it now.

Anton

Tony Jollans said:
I don't see why you 'obviously' have lots of spaces and returns at the start
of a document - but if that's all you want to get rid of you're not going to
find anything a whole lot easier than going to the top of the document and
doing it manually

I just did a search for the first non-space non-paragraph mark and recorded
this if it helps ...

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 28/03/2006 by Tony
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[!^13 ]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
Selection.TypeBackspace
End Sub


--
Enjoy,
Tony

"Ant (antonfh_at_gmail_dot_com)"
How can I remove all spaces (lines) aka? Hard-returns at the top of a page in
my document, is there a macro I can do this with.

It should be something to write as "clean-up-process" after editing a doc,
since any editing would move text around again and obviously result in some
spaces at the top of a doc.

I tried to look for some examples but most removes all line breaks or
hard-returns, I am looking only for something that will find theses spaces
(breaks) at the top of the page and remove them up to the first line of text
on that page.

Hope this makes sense
 
T

Tony Jollans

Unless you have hard page breaks all over the place then what is at the top
of page 2, say, will change when you delete content from the top of page 1 -
so doing this by page doesn't really make sense.

If you want to replace ALL multiple instances of spaces and returns you
could use a Find and Replace of ---

Find [^13 ]{2,}([!^13 ]) - if I've typed correctly that should be left
(square) bracket, caret, one, three, space, right bracket, left brace, two,
comma, right brace, left parenthesis, left bracket, exclamation mark, caret,
one, three, space, right bracket, right parenthesis.

Replace \1 - that's backslash, one

Check Use Wildcards and hit Replace All

If you do have manual page breaks then you can search for multiple spaces
following them with ---

Find string of (^m)[^13 ]{1,}([!^13 ]) - that's as above preceded by left
parenthesis, caret, lower case letter em, right parenthesis and with the two
inside the braces replaced with a one.
And a Replace string of \1\2

Please come back if it's something differeent.

--
Enjoy,
Tony

"Ant (antonfh_at_gmail_dot_com)"
Tony.

No no, not the top of the document, at the top of certain pages, I have 7
documents, some with over 500 pages, so for me to go and try to find a space
(or more) at the top of a page and deleting them by hand is not that easy,
and then someone changes the document and I have to do a search and find all
over again to make sure each page of the 500 page document has no spaces at
the top ...thats where the problem comes in.

Thanks for the code, going to try it now.

Anton

Tony Jollans said:
I don't see why you 'obviously' have lots of spaces and returns at the start
of a document - but if that's all you want to get rid of you're not going to
find anything a whole lot easier than going to the top of the document and
doing it manually

I just did a search for the first non-space non-paragraph mark and recorded
this if it helps ...

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 28/03/2006 by Tony
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[!^13 ]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
Selection.TypeBackspace
End Sub


--
Enjoy,
Tony

"Ant (antonfh_at_gmail_dot_com)"
How can I remove all spaces (lines) aka? Hard-returns at the top of a
page
in
my document, is there a macro I can do this with.

It should be something to write as "clean-up-process" after editing a doc,
since any editing would move text around again and obviously result in some
spaces at the top of a doc.

I tried to look for some examples but most removes all line breaks or
hard-returns, I am looking only for something that will find theses spaces
(breaks) at the top of the page and remove them up to the first line
of
text
on that page.

Hope this makes sense
 
G

Guest

Tony Jolians.

First of thank you for your time and assistance.

Ok I tried the find and replace, the first one with the replace of \1 worked
in a way, but it took away some hard-returns, resulting in one big paragraph
for example, the other one with the replace of \1\2 did not seem to remove
the line breaks at top of pages.

The piece of code you send first time actually worked like a charm, if only
on the first page of the document, if that code could run for each page of
the document that would be the ideal situation.

You see the thing with this is that this is a project for a assignment and
the lecturers are very specific that they dont allow any space at the top of
the page (now I ask you with tears in my eyes, how are you supposed to
reformat your document each time and take out spaces at the top of a page
without using some script ?)

Thank you for your help.


Anton

Tony Jollans said:
Unless you have hard page breaks all over the place then what is at the top
of page 2, say, will change when you delete content from the top of page 1 -
so doing this by page doesn't really make sense.

If you want to replace ALL multiple instances of spaces and returns you
could use a Find and Replace of ---

Find [^13 ]{2,}([!^13 ]) - if I've typed correctly that should be left
(square) bracket, caret, one, three, space, right bracket, left brace, two,
comma, right brace, left parenthesis, left bracket, exclamation mark, caret,
one, three, space, right bracket, right parenthesis.

Replace \1 - that's backslash, one

Check Use Wildcards and hit Replace All

If you do have manual page breaks then you can search for multiple spaces
following them with ---

Find string of (^m)[^13 ]{1,}([!^13 ]) - that's as above preceded by left
parenthesis, caret, lower case letter em, right parenthesis and with the two
inside the braces replaced with a one.
And a Replace string of \1\2

Please come back if it's something differeent.

--
Enjoy,
Tony

"Ant (antonfh_at_gmail_dot_com)"
Tony.

No no, not the top of the document, at the top of certain pages, I have 7
documents, some with over 500 pages, so for me to go and try to find a space
(or more) at the top of a page and deleting them by hand is not that easy,
and then someone changes the document and I have to do a search and find all
over again to make sure each page of the 500 page document has no spaces at
the top ...thats where the problem comes in.

Thanks for the code, going to try it now.

Anton

Tony Jollans said:
I don't see why you 'obviously' have lots of spaces and returns at the start
of a document - but if that's all you want to get rid of you're not going to
find anything a whole lot easier than going to the top of the document and
doing it manually

I just did a search for the first non-space non-paragraph mark and recorded
this if it helps ...

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 28/03/2006 by Tony
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[!^13 ]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
Selection.TypeBackspace
End Sub


--
Enjoy,
Tony

"Ant (antonfh_at_gmail_dot_com)"
How can I remove all spaces (lines) aka? Hard-returns at the top of a page
in
my document, is there a macro I can do this with.

It should be something to write as "clean-up-process" after editing a doc,
since any editing would move text around again and obviously result in
some
spaces at the top of a doc.

I tried to look for some examples but most removes all line breaks or
hard-returns, I am looking only for something that will find theses spaces
(breaks) at the top of the page and remove them up to the first line of
text
on that page.

Hope this makes sense
 
T

Tony Jollans

Hmmm - the first will remove - completely remove - multiple consecutive
occurrences of (either space or paragraph mark) so a paragraph ending in a
space will get cleared. This is one of the difficulties of doing this sort
of thing remotely :)

Now I understand what you are trying to do, the real answer is to use Styles
with the formatting you want in the first place instead of trying to lay out
your document with extra spaces and lines. A well formatted document will
never have extra spaces and paragraph marks anywhere and the proper use of
styles will make it easier to work with as well and no reformatting needed.

I have to go out now - I'm afraid my family are more important to me than
you are :) - but if nobody else jumps in I will post back in, maybe, three
hours.

--
Enjoy,
Tony

"Ant (antonfh_at_gmail_dot_com)"
Tony Jolians.

First of thank you for your time and assistance.

Ok I tried the find and replace, the first one with the replace of \1 worked
in a way, but it took away some hard-returns, resulting in one big paragraph
for example, the other one with the replace of \1\2 did not seem to remove
the line breaks at top of pages.

The piece of code you send first time actually worked like a charm, if only
on the first page of the document, if that code could run for each page of
the document that would be the ideal situation.

You see the thing with this is that this is a project for a assignment and
the lecturers are very specific that they dont allow any space at the top of
the page (now I ask you with tears in my eyes, how are you supposed to
reformat your document each time and take out spaces at the top of a page
without using some script ?)

Thank you for your help.


Anton

Tony Jollans said:
Unless you have hard page breaks all over the place then what is at the top
of page 2, say, will change when you delete content from the top of page 1 -
so doing this by page doesn't really make sense.

If you want to replace ALL multiple instances of spaces and returns you
could use a Find and Replace of ---

Find [^13 ]{2,}([!^13 ]) - if I've typed correctly that should be left
(square) bracket, caret, one, three, space, right bracket, left brace, two,
comma, right brace, left parenthesis, left bracket, exclamation mark, caret,
one, three, space, right bracket, right parenthesis.

Replace \1 - that's backslash, one

Check Use Wildcards and hit Replace All

If you do have manual page breaks then you can search for multiple spaces
following them with ---

Find string of (^m)[^13 ]{1,}([!^13 ]) - that's as above preceded by left
parenthesis, caret, lower case letter em, right parenthesis and with the two
inside the braces replaced with a one.
And a Replace string of \1\2

Please come back if it's something differeent.

--
Enjoy,
Tony

"Ant (antonfh_at_gmail_dot_com)"
Tony.

No no, not the top of the document, at the top of certain pages, I have 7
documents, some with over 500 pages, so for me to go and try to find a space
(or more) at the top of a page and deleting them by hand is not that easy,
and then someone changes the document and I have to do a search and
find
all
over again to make sure each page of the 500 page document has no
spaces
at
the top ...thats where the problem comes in.

Thanks for the code, going to try it now.

Anton

:

I don't see why you 'obviously' have lots of spaces and returns at
the
start
of a document - but if that's all you want to get rid of you're not going to
find anything a whole lot easier than going to the top of the
document
and
doing it manually

I just did a search for the first non-space non-paragraph mark and recorded
this if it helps ...

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 28/03/2006 by Tony
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[!^13 ]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
Selection.TypeBackspace
End Sub


--
Enjoy,
Tony

"Ant (antonfh_at_gmail_dot_com)"
How can I remove all spaces (lines) aka? Hard-returns at the top
of a
page
in
my document, is there a macro I can do this with.

It should be something to write as "clean-up-process" after
editing a
doc,
since any editing would move text around again and obviously result in
some
spaces at the top of a doc.

I tried to look for some examples but most removes all line breaks or
hard-returns, I am looking only for something that will find
theses
spaces
(breaks) at the top of the page and remove them up to the first
line
of
text
on that page.

Hope this makes sense
 
S

Suzanne S. Barnhill

You're going at this the wrong way. Unlike WordPerfect, Word never
"suppresses" extra paragraphs. That's because every paragraph is meaningful
to Word; even in an empty paragraph, the paragraph mark contains information
about dozens of font and paragraph properties (so these extra paragraphs add
to the file size).

Instead of using empty paragraphs to create a "blank line" between text
paragraphs, use Space Before/After. That's what it's for, and it *is*
suppressed at the top/bottom of a page. To easily add 12 points Space Before
(the equivalent of a "blank line"), press Ctrl+0 (zero). As Tony suggests,
however, the proper way to apply this formatting is with styles.

The bottom line, however, is that if you remove *all* empty paragraphs (not
just the ones that occur at the tops of pages), then you will not have this
problem.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Ant (antonfh_at_gmail_dot_com)"
 
G

Guest

Yes, I know your frustration now, me trying to convey the problem, you trying
to try and make out what on earth I am on about.

Why cant it be as simple as some script that checks each page, removes all
ASCI code for line breaks until it finds a text string and then goes on to
the next page, sounds so simple, but alas I have no clue of doing VB in word,
or writing any other script (so for me it is 100% impossible) other than to
come up with the concept.

Go and have fun with the family, Im on my way home too, will check tomrow
morning again (so that gives you over 12 hours before I am back again)

I have used some styles to some extend, but still (Also note here - I am not
trying to remove extra spaces, the thing is the paragraph might end just on
the last line of the page, on the next page it should by all means add a line
break to go into the next parag. or point, but now there is Lecturers who
demand that each page must start without that bloody space) ... maybe they
just want to be difficult?

Thanks Tony, Im trying to figure out your code you send first time to see if
I can get it to check each page... and obviously I am not getting anywhere ;-)

Anton

Tony Jollans said:
Hmmm - the first will remove - completely remove - multiple consecutive
occurrences of (either space or paragraph mark) so a paragraph ending in a
space will get cleared. This is one of the difficulties of doing this sort
of thing remotely :)

Now I understand what you are trying to do, the real answer is to use Styles
with the formatting you want in the first place instead of trying to lay out
your document with extra spaces and lines. A well formatted document will
never have extra spaces and paragraph marks anywhere and the proper use of
styles will make it easier to work with as well and no reformatting needed.

I have to go out now - I'm afraid my family are more important to me than
you are :) - but if nobody else jumps in I will post back in, maybe, three
hours.

--
Enjoy,
Tony

"Ant (antonfh_at_gmail_dot_com)"
Tony Jolians.

First of thank you for your time and assistance.

Ok I tried the find and replace, the first one with the replace of \1 worked
in a way, but it took away some hard-returns, resulting in one big paragraph
for example, the other one with the replace of \1\2 did not seem to remove
the line breaks at top of pages.

The piece of code you send first time actually worked like a charm, if only
on the first page of the document, if that code could run for each page of
the document that would be the ideal situation.

You see the thing with this is that this is a project for a assignment and
the lecturers are very specific that they dont allow any space at the top of
the page (now I ask you with tears in my eyes, how are you supposed to
reformat your document each time and take out spaces at the top of a page
without using some script ?)

Thank you for your help.


Anton

Tony Jollans said:
Unless you have hard page breaks all over the place then what is at the top
of page 2, say, will change when you delete content from the top of page 1 -
so doing this by page doesn't really make sense.

If you want to replace ALL multiple instances of spaces and returns you
could use a Find and Replace of ---

Find [^13 ]{2,}([!^13 ]) - if I've typed correctly that should be left
(square) bracket, caret, one, three, space, right bracket, left brace, two,
comma, right brace, left parenthesis, left bracket, exclamation mark, caret,
one, three, space, right bracket, right parenthesis.

Replace \1 - that's backslash, one

Check Use Wildcards and hit Replace All

If you do have manual page breaks then you can search for multiple spaces
following them with ---

Find string of (^m)[^13 ]{1,}([!^13 ]) - that's as above preceded by left
parenthesis, caret, lower case letter em, right parenthesis and with the two
inside the braces replaced with a one.
And a Replace string of \1\2

Please come back if it's something differeent.

--
Enjoy,
Tony

"Ant (antonfh_at_gmail_dot_com)"
Tony.

No no, not the top of the document, at the top of certain pages, I have 7
documents, some with over 500 pages, so for me to go and try to find a
space
(or more) at the top of a page and deleting them by hand is not that easy,
and then someone changes the document and I have to do a search and find
all
over again to make sure each page of the 500 page document has no spaces
at
the top ...thats where the problem comes in.

Thanks for the code, going to try it now.

Anton

:

I don't see why you 'obviously' have lots of spaces and returns at the
start
of a document - but if that's all you want to get rid of you're not
going to
find anything a whole lot easier than going to the top of the document
and
doing it manually

I just did a search for the first non-space non-paragraph mark and
recorded
this if it helps ...

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 28/03/2006 by Tony
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[!^13 ]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
Selection.TypeBackspace
End Sub


--
Enjoy,
Tony

"Ant (antonfh_at_gmail_dot_com)"
message
How can I remove all spaces (lines) aka? Hard-returns at the top of a
page
in
my document, is there a macro I can do this with.

It should be something to write as "clean-up-process" after editing a
doc,
since any editing would move text around again and obviously result in
some
spaces at the top of a doc.

I tried to look for some examples but most removes all line breaks or
hard-returns, I am looking only for something that will find theses
spaces
(breaks) at the top of the page and remove them up to the first line
of
text
on that page.

Hope this makes sense
 
R

Robert M. Franz (RMF)

Hi Suzanne

Suzanne S. Barnhill wrote:
[..]
Instead of using empty paragraphs to create a "blank line" between text
paragraphs, use Space Before/After. That's what it's for, and it *is*
suppressed at the top/bottom of a page. [..]

Well, at least in most cases. Depending on how exactly a paragraph falls
unto a new page, and on compatibility options.

I have yet to find the perfect setting that suits all my needs, though
(and hence try to limit "spacing before" in simple templates whenever
possible).

2cents
Robert
 
W

Word Heretic

G'day "Robert M. Franz (RMF) said:
I have yet to find the perfect setting that suits all my needs

It doesn't exist. You can get very close if you tailor to each defined
document type, with the most significant analysis being the authors.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


Robert M. Franz (RMF) reckoned:
Hi Suzanne

Suzanne S. Barnhill wrote:
[..]
Instead of using empty paragraphs to create a "blank line" between text
paragraphs, use Space Before/After. That's what it's for, and it *is*
suppressed at the top/bottom of a page. [..]

Well, at least in most cases. Depending on how exactly a paragraph falls
unto a new page, and on compatibility options.

I have yet to find the perfect setting that suits all my needs, though
(and hence try to limit "spacing before" in simple templates whenever
possible).

2cents
Robert
 
T

Tony Jollans

Hi Ant,

If you work with Word it will repay your effort but if you work against it
you will forever have problems. If Suzanne's post doesn't push you in the
right direction, do come back.

--
Enjoy,
Tony

"Ant (antonfh_at_gmail_dot_com)"
Yes, I know your frustration now, me trying to convey the problem, you trying
to try and make out what on earth I am on about.

Why cant it be as simple as some script that checks each page, removes all
ASCI code for line breaks until it finds a text string and then goes on to
the next page, sounds so simple, but alas I have no clue of doing VB in word,
or writing any other script (so for me it is 100% impossible) other than to
come up with the concept.

Go and have fun with the family, Im on my way home too, will check tomrow
morning again (so that gives you over 12 hours before I am back again)

I have used some styles to some extend, but still (Also note here - I am not
trying to remove extra spaces, the thing is the paragraph might end just on
the last line of the page, on the next page it should by all means add a line
break to go into the next parag. or point, but now there is Lecturers who
demand that each page must start without that bloody space) ... maybe they
just want to be difficult?

Thanks Tony, Im trying to figure out your code you send first time to see if
I can get it to check each page... and obviously I am not getting anywhere ;-)

Anton

Tony Jollans said:
Hmmm - the first will remove - completely remove - multiple consecutive
occurrences of (either space or paragraph mark) so a paragraph ending in a
space will get cleared. This is one of the difficulties of doing this sort
of thing remotely :)

Now I understand what you are trying to do, the real answer is to use Styles
with the formatting you want in the first place instead of trying to lay out
your document with extra spaces and lines. A well formatted document will
never have extra spaces and paragraph marks anywhere and the proper use of
styles will make it easier to work with as well and no reformatting needed.

I have to go out now - I'm afraid my family are more important to me than
you are :) - but if nobody else jumps in I will post back in, maybe, three
hours.

--
Enjoy,
Tony

"Ant (antonfh_at_gmail_dot_com)"
Tony Jolians.

First of thank you for your time and assistance.

Ok I tried the find and replace, the first one with the replace of \1 worked
in a way, but it took away some hard-returns, resulting in one big paragraph
for example, the other one with the replace of \1\2 did not seem to remove
the line breaks at top of pages.

The piece of code you send first time actually worked like a charm, if only
on the first page of the document, if that code could run for each page of
the document that would be the ideal situation.

You see the thing with this is that this is a project for a assignment and
the lecturers are very specific that they dont allow any space at the
top
of
the page (now I ask you with tears in my eyes, how are you supposed to
reformat your document each time and take out spaces at the top of a page
without using some script ?)

Thank you for your help.


Anton

:

Unless you have hard page breaks all over the place then what is at
the
top
of page 2, say, will change when you delete content from the top of
page
1 -
so doing this by page doesn't really make sense.

If you want to replace ALL multiple instances of spaces and returns you
could use a Find and Replace of ---

Find [^13 ]{2,}([!^13 ]) - if I've typed correctly that should be left
(square) bracket, caret, one, three, space, right bracket, left
brace,
two,
comma, right brace, left parenthesis, left bracket, exclamation
mark,
caret,
one, three, space, right bracket, right parenthesis.

Replace \1 - that's backslash, one

Check Use Wildcards and hit Replace All

If you do have manual page breaks then you can search for multiple spaces
following them with ---

Find string of (^m)[^13 ]{1,}([!^13 ]) - that's as above preceded
by
left
parenthesis, caret, lower case letter em, right parenthesis and with
the
two
inside the braces replaced with a one.
And a Replace string of \1\2

Please come back if it's something differeent.

--
Enjoy,
Tony

"Ant (antonfh_at_gmail_dot_com)"
Tony.

No no, not the top of the document, at the top of certain pages, I have 7
documents, some with over 500 pages, so for me to go and try to find a
space
(or more) at the top of a page and deleting them by hand is not
that
easy,
and then someone changes the document and I have to do a search
and
find
all
over again to make sure each page of the 500 page document has no spaces
at
the top ...thats where the problem comes in.

Thanks for the code, going to try it now.

Anton

:

I don't see why you 'obviously' have lots of spaces and returns
at
the
start
of a document - but if that's all you want to get rid of you're not
going to
find anything a whole lot easier than going to the top of the document
and
doing it manually

I just did a search for the first non-space non-paragraph mark and
recorded
this if it helps ...

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 28/03/2006 by Tony
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[!^13 ]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
Selection.TypeBackspace
End Sub


--
Enjoy,
Tony

"Ant (antonfh_at_gmail_dot_com)"
message
How can I remove all spaces (lines) aka? Hard-returns at the
top
of a
page
in
my document, is there a macro I can do this with.

It should be something to write as "clean-up-process" after editing a
doc,
since any editing would move text around again and obviously result in
some
spaces at the top of a doc.

I tried to look for some examples but most removes all line
breaks
or
hard-returns, I am looking only for something that will find theses
spaces
(breaks) at the top of the page and remove them up to the
first
line
of
text
on that page.

Hope this makes sense
 
S

Suzanne S. Barnhill

Space Before is always suppressed at the top of a page following a "soft"
page break.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Robert M. Franz (RMF) said:
Hi Suzanne

Suzanne S. Barnhill wrote:
[..]
Instead of using empty paragraphs to create a "blank line" between text
paragraphs, use Space Before/After. That's what it's for, and it *is*
suppressed at the top/bottom of a page. [..]

Well, at least in most cases. Depending on how exactly a paragraph falls
unto a new page, and on compatibility options.

I have yet to find the perfect setting that suits all my needs, though
(and hence try to limit "spacing before" in simple templates whenever
possible).

2cents
Robert
--
/"\ ASCII Ribbon Campaign | MS
\ / | MVP
X Against HTML | for
/ \ in e-mail & news | Word
 
J

John McGhie [MVP - Word and Word Macintosh]

Try twice the font height before and 10 pts after for headings, and only 10
pts after for body styles.

Ensure that Word throws each paragraph to the top of the next page, or set
the "Suppress space above at the top of page" compatibility options if you
must use hard page breaks :)


Hi Suzanne

Suzanne S. Barnhill wrote:
[..]
Instead of using empty paragraphs to create a "blank line" between text
paragraphs, use Space Before/After. That's what it's for, and it *is*
suppressed at the top/bottom of a page. [..]

Well, at least in most cases. Depending on how exactly a paragraph falls
unto a new page, and on compatibility options.

I have yet to find the perfect setting that suits all my needs, though
(and hence try to limit "spacing before" in simple templates whenever
possible).

2cents
Robert

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer
Sydney, Australia +61 (0) 4 1209 1410
 
R

Robert M. Franz (RMF)

Hi all
Space Before is always suppressed at the top of a page following a "soft"
page break.

OK, my observation (a long time ago and under Word 2000 IIRC) was this:

A. 1st para of document
Spacing before always honored

B. Para gets to new page "naturally" (not through any pagination
properties, not even w/o-control)
Spacing before always suppressed

C. Para forced unto new page through KeepWithNext
Spacing before always suppressed

D. Para forced unto new page through KeepLinesTogether
Spacing before always suppressed

E. Para forced unto new page through PageBreakBefore
Spacing before always honored

F. Para forced unto new page through SectionBreak (next page, though I
don't think the type matters)
Spacing before always honored

G. Para forced unto new page through ugly/hard PageBreak
Spacing before honored depending on compatibility setting

All in all, the only time where this comp. setting seems to take effect
is case G with the hard page break (and frankly, I don't care for that
one at all :)).

But that the behaviour is different through Cases A-F, especially
through B-E, is a real PITA.

Greetingx
Robert
 
S

Suzanne S. Barnhill

This sums up my experience as well. This is the way I like it, and I use it
to advantage. I wish, however, that there were an option to suppress Space
Before after a column break.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top