Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Grey Old Man Grey Old Man is offline
external usenet poster
 
Posts: 8
Default Removal of redundant spaces

I am attempting a word macro to tidy up a large volume of text. I have a few
questions that I hope somebody can help me with.

The space bar has been used extensively to indent the text from the left!

I have used:

With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = " [ ]@([! ])"
.Replacement.Text = " \1"
.MatchWildcards = True
.Wrap = wdFindStop
.Format = False
.Forward = True
.Execute Replace:=wdReplaceAll
End With
End With

to remove multiple spaces but this leaves a single space before the first
capitalized letter.

€¦€¦€¦..Sentence starts here (multiple leading spaces)

becomes

..Sentence starts here (single leading space)

Any ideas on how to remove the offending single space?


Secondly, trailing spaces have been used in a table. What is the equivalent
to paragraph mark ^p or new line mark ^l when confined to a table?

Table text €¦€¦€¦


Thanks in anticipation.

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Removal of redundant spaces

CTRL+A then CTRL+E then CTRL+L should remove all leading and trailing spaces
whether in the main document area or table cells. No need for a macro.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"Grey Old Man" wrote in message
news
I am attempting a word macro to tidy up a large volume of text. I have a
few
questions that I hope somebody can help me with.

The space bar has been used extensively to indent the text from the left!

I have used:

With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = " [ ]@([! ])"
.Replacement.Text = " \1"
.MatchWildcards = True
.Wrap = wdFindStop
.Format = False
.Forward = True
.Execute Replace:=wdReplaceAll
End With
End With

to remove multiple spaces but this leaves a single space before the first
capitalized letter.

.....Sentence starts here (multiple leading spaces)

becomes

.Sentence starts here (single leading space)

Any ideas on how to remove the offending single space?


Secondly, trailing spaces have been used in a table. What is the
equivalent
to paragraph mark ^p or new line mark ^l when confined to a table?

Table text ...


Thanks in anticipation.



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Removal of redundant spaces

CTRL+A then CTRL+E then CTRL+L should remove all leading and trailing spaces
whether in the main document area or table cells. No need for a macro.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"Grey Old Man" wrote in message
news
I am attempting a word macro to tidy up a large volume of text. I have a
few
questions that I hope somebody can help me with.

The space bar has been used extensively to indent the text from the left!

I have used:

With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = " [ ]@([! ])"
.Replacement.Text = " \1"
.MatchWildcards = True
.Wrap = wdFindStop
.Format = False
.Forward = True
.Execute Replace:=wdReplaceAll
End With
End With

to remove multiple spaces but this leaves a single space before the first
capitalized letter.

.....Sentence starts here (multiple leading spaces)

becomes

.Sentence starts here (single leading space)

Any ideas on how to remove the offending single space?


Secondly, trailing spaces have been used in a table. What is the
equivalent
to paragraph mark ^p or new line mark ^l when confined to a table?

Table text ...


Thanks in anticipation.



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
DeanH DeanH is offline
external usenet poster
 
Posts: 1,862
Default Removal of redundant spaces

Little trick for you, changing selected text from Left/Right/Justified to
Centred alignment, then back will remove superfluous spacing and tabs from
the beginning and end of the text paragraph.
This helps especially in table cells where there is not search facility for
End of Cell marker (this has been asked here many times before without ajor
success).
Hopefully you can use this little trick in your macro.

See also http://gregmaxey.mvps.org/Clean_Up_Text.htm for a previously
created "macro" that you can have a look at.

Hope this helps
DeanH


"Grey Old Man" wrote:

I am attempting a word macro to tidy up a large volume of text. I have a few
questions that I hope somebody can help me with.

The space bar has been used extensively to indent the text from the left!

I have used:

With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = " [ ]@([! ])"
.Replacement.Text = " \1"
.MatchWildcards = True
.Wrap = wdFindStop
.Format = False
.Forward = True
.Execute Replace:=wdReplaceAll
End With
End With

to remove multiple spaces but this leaves a single space before the first
capitalized letter.

€¦€¦€¦..Sentence starts here (multiple leading spaces)

becomes

.Sentence starts here (single leading space)

Any ideas on how to remove the offending single space?


Secondly, trailing spaces have been used in a table. What is the equivalent
to paragraph mark ^p or new line mark ^l when confined to a table?

Table text €¦€¦€¦


Thanks in anticipation.

  #5   Report Post  
Posted to microsoft.public.word.docmanagement
DeanH DeanH is offline
external usenet poster
 
Posts: 1,862
Default Removal of redundant spaces


Little trick for you, changing selected text from Left/Right/Justified to
Centred alignment, then back will remove superfluous spacing and tabs from
the beginning and end of the text paragraph.
This helps especially in table cells where there is not search facility for
End of Cell marker (this has been asked here many times before without ajor
success).
Hopefully you can use this little trick in your macro.

See also http://gregmaxey.mvps.org/Clean_Up_Text.htm for a previously
created "macro" that you can have a look at.

Hope this helps
DeanH


"Grey Old Man" wrote:

I am attempting a word macro to tidy up a large volume of text. I have a few
questions that I hope somebody can help me with.

The space bar has been used extensively to indent the text from the left!

I have used:

With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = " [ ]@([! ])"
.Replacement.Text = " \1"
.MatchWildcards = True
.Wrap = wdFindStop
.Format = False
.Forward = True
.Execute Replace:=wdReplaceAll
End With
End With

to remove multiple spaces but this leaves a single space before the first
capitalized letter.

€¦€¦€¦..Sentence starts here (multiple leading spaces)

becomes

.Sentence starts here (single leading space)

Any ideas on how to remove the offending single space?


Secondly, trailing spaces have been used in a table. What is the equivalent
to paragraph mark ^p or new line mark ^l when confined to a table?

Table text €¦€¦€¦


Thanks in anticipation.

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
Redundant extra page tcebob New Users 11 June 20th 07 04:15 PM
Eliminating redundant spaces Scott Meyers New Users 4 June 17th 06 06:29 AM
Removing redundant characters ralf Formatting Long Documents 2 July 19th 05 08:43 AM
redundant words ambrozia Microsoft Word Help 1 March 10th 05 09:45 PM
Inserting redundant text The Butler From Tennessee Microsoft Word Help 2 November 30th 04 08:31 PM


All times are GMT +1. The time now is 09:21 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"