Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Tech Tips & Tricks
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory modem monitor motherboard network printer problem ram registry router security slow software sound toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > General Technology > Tech Tips & Tricks >
Strip excess paragraphs & spaces in Word

Reply  
Thread Tools
Saxon's Avatar
Senior Member with 328 posts.
 
Join Date: Jul 2005
Experience: Advanced
08-Aug-2005, 07:42 AM #1
Strip excess paragraphs & spaces in Word
Do you ever receive Word files with annoyingly long gaps between paragraphs and words. This Macro will strip them away leaving one blank line between each paragraph and one space between each word. Neat!!

Just one thing. The line below which reads
For x = 1 to To 30
will only deal with 30 lines. I recommend you change the 30 to 300 or whatever you think is appropriate for you. The Macro will still run effectively no matter how many lines you enter, it will just take longer to complete that's all.

Copy the Macro below the dotted line.

Update: - I've been informed that spaces of more than one between words are not shown on this forum, so when you copy/paste this Macro please insert one more space in the first .Text=" "entry below
-----------------------------------------------

Sub StripSpacePara()
For x = 1 To 30
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p^p^p"
.Replacement.Text = "^p^p"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = " "
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next x
End Sub
__________________
"We can proceed with a velvet glove, but within must lie an iron fist."

Otto Von Bismarck

Last edited by Saxon; 09-Aug-2005 at 07:04 AM..
ChuckE's Avatar
Senior Member with 2,709 posts.
 
Join Date: Aug 2004
Location: Redondo Beach, CA
Experience: Advanced
09-Aug-2005, 03:15 AM #2
You second portion, the part that searches for two spaces and replaces with one space, does not get presented well in this forum. The two spaces are shown here as just one space, so you might want to tell people to edit the copy from the posting.

By the way, you wanted a macro for this?
Is it that hard to do a manual S&R (Search & Replace)?
__________________
Give a woman an inch, and she'll want six.
Saxon's Avatar
Senior Member with 328 posts.
 
Join Date: Jul 2005
Experience: Advanced
09-Aug-2005, 06:50 AM #3
Thanks for the info on the Text space bit, will have to to a REM next time if spaces are not shown properly in the forum. I think your missing the point with the find/replace option, once made this is available always and can be assigned to a Toolbar button which will do the job instantly with one mouse click.
__________________
"We can proceed with a velvet glove, but within must lie an iron fist."

Otto Von Bismarck

Last edited by Saxon; 09-Aug-2005 at 06:58 AM..
ChuckE's Avatar
Senior Member with 2,709 posts.
 
Join Date: Aug 2004
Location: Redondo Beach, CA
Experience: Advanced
09-Aug-2005, 02:36 PM #4
Oh I understand that having a Toolbar button is very convenient, I just thought it was a bit of overkill for something that seems so easy (maybe it is just me).

What I think is very valuable is that you brought up the idea that some people have just not even thought of, yet. That is, to search for two "c/r's" and replacing with one (to remove extra c/r's), and to search for two spaces and replace with one.

It is surprising how many people just don't have a clue. But your post maybe gets some people some insight. Thanks.
__________________
Give a woman an inch, and she'll want six.
Saxon's Avatar
Senior Member with 328 posts.
 
Join Date: Jul 2005
Experience: Advanced
10-Aug-2005, 06:46 AM #5
Thanks for all that ChuckE, and I hope people will try both methods, but here as in the real world it's a case of 'Horses for Courses' and whether the horse is called Overkill will not matter. I have a sneaking feeling that people are going to bet on it if it always gets to the winning post first.
__________________
"We can proceed with a velvet glove, but within must lie an iron fist."

Otto Von Bismarck
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:56 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.