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