Thread: [Solved] VBA IF Statement Help
View Single Post
 
Old 03-20-2024, 03:06 PM
gmaxey gmaxey is offline Windows 10 Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,601
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Shelley,


The reason for the replacement is code that I added to the CompoundCR procedure to replace 2 or more spaces with a singe space. That fixed that one issue where the CR number wasn't being picked up. You can take that out if you wish.
Code:
With oRng.Find 
  .ClearFormatting 
  .Replacement.ClearFormatting 
  .Forward = True 
  .Wrap = wdFindStop
  .MatchWildcards = True
   .Text = "[ ^s]{2,}"
   .Replacement.Text = " "
   .Execute  Replace:=wdReplaceAll
End With
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote