Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-08-2024, 01:42 AM
yacov yacov is offline clean extra space Windows 10 clean extra space Office 2016
Competent Performer
clean extra space
 
Join Date: Oct 2019
Posts: 146
yacov is on a distinguished road
Default clean extra space

Hello,
I tried to change the macro below so that in one run it will delete an unnecessary space next to the + - signs
Is it possible?
I can duplicate the macro and put one mark per macro but that leaves me with a lot of shortcuts.
Thanks

Sub MFindReplacePARA()
Dim aDoc As Document, strFindText As String, strReplaceText As String
strFindText = "^p^p"
strReplaceText = "^p"
strFindText = " +"
strReplaceText = "+"
strFindText = "+ "
strReplaceText = "+"
strFindText = "- "
strReplaceText = "-"
strFindText = " -"
strReplaceText = "-"
For Each aDoc In Application.Documents
With aDoc.Range.Find
.Text = strFindText
.Replacement.Text = strReplaceText
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll


End With
Next aDoc
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing extra space between word BillMcEnaney Word 9 02-16-2023 11:03 PM
How to delete extra space (between lines)? Gerald Wilhelm Word 15 08-26-2020 04:08 AM
clean extra space Merge field needs extra space when it populates jaj42305 Mail Merge 3 04-21-2016 03:33 PM
extra space before equation Nice2007 Word 1 04-27-2012 05:05 PM
clean extra space Slight extra space between lines. lucadelcarlo Word 1 04-23-2011 04:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:58 PM.


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