Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-06-2022, 04:36 PM
Guessed's Avatar
Guessed Guessed is offline I have a code in vba to delete trailing spaces but it is deleting others text too. Windows 10 I have a code in vba to delete trailing spaces but it is deleting others text too. Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Can you explain exactly what you want the code to do?

As a start, the code you have supplied only works on the first selected paragraph. If you want the code to work on every paragraph and it involves deleting stuff then you should work backwards from the end of the document. The initial lines would then be...
Code:
For e = ActiveDocument.Paragraphs.Count to 1 step -1
Set para = ActiveDocument.Paragraphs(e)
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
I have a code in vba to delete trailing spaces but it is deleting others text too. How to Remove trailing spaces AND line breaks in a block of text JulianS96 Word 4 02-04-2020 04:20 AM
I have a code in vba to delete trailing spaces but it is deleting others text too. Deleting text but keeping adjacent spaces Alsadius Word VBA 6 03-04-2019 02:50 PM
I have a code in vba to delete trailing spaces but it is deleting others text too. Removing trailing spaces from footnotes risomd Word VBA 11 08-30-2018 06:00 PM
I have a code in vba to delete trailing spaces but it is deleting others text too. How to remove trailing & leading spaces in a cell? LearnerExcel Excel Programming 8 02-04-2018 08:22 PM
I have a code in vba to delete trailing spaces but it is deleting others text too. Mail Merge - Trailing Spaces osucjb Mail Merge 5 10-28-2016 12:03 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:20 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