Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delete blank lines in a Document

Posted on 2006-06-09
8
Medium Priority
?
2,874 Views
Last Modified: 2008-03-19
I have a word document that is generated by a batch commnand that pings every machine in my domain and outputs to a Pinged.doc file.. After completion, I run a search and replace to get rid of unwanted lines to leave me with simply the machine name, percent loss and IP address. This leaves many blank lines throughout the document. I just need a VB script that will run through the document, line by line, and if the line is blank, delete it. I know that this is a simple fix, but I just can't get it. Any help would be appreciated.
0
Comment
Question by:sscottincanyon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 16871964
You dont need a script.

Just do Find and Replace on paragraph marks.
Find : ^p^p
Replace: ^p

Do this until you get no replacements reported.
0
 
LVL 2

Author Comment

by:sscottincanyon
ID: 16872437
Thanks for the help. It didn't quite work. When I use :
Find : ^p^p
Replace: ^p
I get zero results, however, if i use
Find : ^p
Replace:
it removes about half of the blank lines.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 16872785
It may be that your document does not always use paragraphs to start new lines. That is the normal way, but yours could be different. For example, you could be using newline characters that are found by ^l ( carat and lower case L).

You could try posting a sample document here:
http://www.ee-stuff.com/
and informing us by posting another comment in this question.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
LVL 8

Expert Comment

by:Galisteo8
ID: 16872835
Click the Show/Hide button on Word's toolbar to show non-printing characters (paragraph marks, manual line breaks, tabs, etc.)  That way, you can see what it is you need to be searching for.  Could be a combination of paragraph and manual line break, which is why searching/replacing for only one or the other removes only some of the lines.
0
 
LVL 2

Author Comment

by:sscottincanyon
ID: 16873408
Ok, GrahamSkan, I have uploaded the document to https://filedb.experts-exchange.com/incoming/ee-stuff/192-pingedtest.zip . Galisteo8, I will try what you have suggested.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 16874099
It works as I suggested with your text document, except that (by the design of Word documents) it cannot replace the last paragraph mark, so it always reports one replacement.
0
 
LVL 2

Author Comment

by:sscottincanyon
ID: 16874219
GrahamSkan, I am going to have to take your word for it. I have fought this all day. I finally renamed my file and downloaded what I had uploaded for you and did exactly what you said, and it worked. Go figure, I have had weird things happening to my network all week. I really appreciate you help. This will save me a lot of time as I have to run this several times.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 16874293
Thanks, not least for your trust and persistence. If you really needed a macro, I would have written one for you - see my answers - but 'the simpler the better' is one of my precepts.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question