Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 04-25-2022, 06:45 PM
Peterson Peterson is offline Remove extra space before a paragraph and return it to previous paragraph Windows 10 Remove extra space before a paragraph and return it to previous paragraph Office 2019
Competent Performer
 
Join Date: Jan 2017
Posts: 143
Peterson is on a distinguished road
Default

In the first sample document, there was a space preceding every paragraph mark in all of the examples, so I wrote the wildcard string to include that space. In addition, the numerals, which were unrelated to the content, let me know where paragraphs ended.

Without the numerals in the first doc, I can't know how to differentiate one paragraph from another, and the macro's purpose is to remove a very common indicator of the end of a paragraph: two consecutive paragraph marks.

Running a modified version of the macro would therefore remove every paragraph mark and add at least one extra space, but you'd end up with a document that consists of just one massive paragraph.

The same would be true for the second document, but there wouldn't be an extra space. (In the second sample document, there are no spaces before or after paragraph marks, which is why the macro isn't working in it.)

You could get around this problem by manually locating the end of every paragraph and typing a short text string as a temporary marker -- I like to use QQ -- run the macro (it needs to be modified first), then replace the markers with paragraph marks.

If the files have spaces at the end of every line because you are copying/pasting from PDFs, then, depending on your PDF app, you should be able to select text in the PDF, right click, and use a "Copy with formatting" feature, which would allow you to paste the text elsewhere without adding paragraph marks at the end of each line. Alternatively, you could open the original PDF into Word, and even though the formatting won't be right, and you wouldn't want to create a file this way, then work on it, you could at least copy text without paragraphs after each line.
Reply With Quote
 

Tags
word 19, word vba, word vba code



Similar Threads
Thread Thread Starter Forum Replies Last Post
a macro to replace paragraph mark with a space applies effect on paragraph marks after the selection drrr Word VBA 2 08-24-2021 03:05 AM
Remove extra space before a paragraph and return it to previous paragraph Delete comma and space after blank merged value. Also remove Previous space and word before blank Alex1s85 Mail Merge 4 01-18-2020 11:30 PM
Remove extra space before a paragraph and return it to previous paragraph Large first character in paragraph causing extra line space dustnik Word 11 09-04-2019 12:47 AM
Add a heading for each paragraph depending on the previous paragraphs numbering herman Word 4 07-15-2019 09:48 PM
Remove extra space before a paragraph and return it to previous paragraph Word thinks 1 sentence is 2 paragraphs and won't let me delete the extra paragraph symbol jrasicmark Word 1 12-05-2014 01:50 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:53 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft