![]() |
#6
|
||||
|
||||
![]() Quote:
Code:
Sub Demo() Application.ScreenUpdating = False Dim Rng As Range With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "([0-9])[Xx]" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True .Execute End With Do While .Find.Found Set Rng = .Duplicate .Duplicate.Characters.Last = "x" With Rng .Start = .Duplicate.End + 1 Do If Not .Characters.Last Like "[/" & vbCr & "]" Then .End = .End + 1 Else Exit Do End If Loop If InStr(1, .Text, "x", vbTextCompare) > 0 Then .Text = Replace(.Text, "x", ".", 1, , vbTextCompare) End With .Start = Rng.End .Find.Execute Loop End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] Last edited by macropod; 04-20-2012 at 07:58 PM. Reason: Code Enhancement to handle upper/lower case 'x' replacement |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
powerdrum | Word VBA | 2 | 12-08-2011 05:06 PM |
Why the "Headings" are appearing in capital letters in the Table of contents? | Jamal NUMAN | Word | 1 | 05-31-2011 08:31 AM |
Search for paras beginging with a lower case | MShroff | Word | 1 | 10-19-2010 06:41 AM |
![]() |
leroytrolley | Excel | 2 | 12-05-2008 02:05 AM |
Upper to lower case | jd | Excel | 1 | 04-28-2006 07:40 AM |