Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 05-09-2018, 12:35 PM
gmaxey gmaxey is offline Macro to remove spaces between characters Windows 7 32bit Macro to remove spaces between characters Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,636
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey, http://gregmaxey.com/word_tips.html, 5/9/2018
Dim oRng As Word.Range
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Text = "  "
    .Replacement.Text = "***"
    .MatchWildcards = True
    .Execute Replace:=wdReplaceAll
  End With
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Text = "(*) (*)"
    .Replacement.Text = "\1\2"
    .MatchWildcards = True
    .Execute Replace:=wdReplaceAll
  End With
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Text = "***"
    .Replacement.Text = " "
    .Execute Replace:=wdReplaceAll
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to remove spaces between characters How to remove blank spaces between rows in a table, Jamal NUMAN Word 2 04-28-2017 12:59 PM
A Widlcard or Macro to Properly Remove Spaces Between Commas? CrossReach Word 6 01-23-2017 04:28 AM
Can I remove spaces between only Chinese characters? sivartnosredna7 Word 2 01-09-2017 05:33 AM
How to remove spaces from Cells which are at the end of value? LearnerExcel Excel 2 12-19-2016 01:10 PM
editing text and remove spaces romanticbiro Word VBA 5 07-04-2014 07:42 PM

Other Forums: Access Forums

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